Code

Remove preallocation of view lines in help_open
authorJonas Fonseca <fonseca@diku.dk>
Wed, 28 Jan 2009 18:28:03 +0000 (19:28 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Wed, 28 Jan 2009 18:28:03 +0000 (19:28 +0100)
tig.c

diff --git a/tig.c b/tig.c
index 095e9c6e92e11dbd41c86e73b5569afdb914cdb4..32f5c7c21499196ff4371a9b83b091536a994cb5 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -3609,22 +3609,11 @@ static struct view_ops diff_ops = {
 static bool
 help_open(struct view *view)
 {
-       int lines = ARRAY_SIZE(req_info) + 2;
        int i;
 
        if (view->lines > 0)
                return TRUE;
 
-       for (i = 0; i < ARRAY_SIZE(req_info); i++)
-               if (!req_info[i].request)
-                       lines++;
-
-       lines += run_requests + 1;
-
-       view->line = calloc(lines, sizeof(*view->line));
-       if (!view->line)
-               return FALSE;
-
        add_line_text(view, "Quick reference for tig keybindings:", LINE_DEFAULT);
 
        for (i = 0; i < ARRAY_SIZE(req_info); i++) {