Code

use xrealloc in help.c
authorJames Bowes <jbowes@dangerouslyinc.com>
Tue, 27 Mar 2007 22:30:08 +0000 (18:30 -0400)
committerJunio C Hamano <junkio@cox.net>
Tue, 27 Mar 2007 23:57:57 +0000 (16:57 -0700)
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
help.c

diff --git a/help.c b/help.c
index be8651a73977f860a87fb944f6fca52af41a2c28..6a9af4d175f2fe9724a2844df63e4011ba91f1b3 100644 (file)
--- a/help.c
+++ b/help.c
@@ -31,12 +31,6 @@ static int term_columns(void)
        return 80;
 }
 
-static void oom(void)
-{
-       fprintf(stderr, "git: out of memory\n");
-       exit(1);
-}
-
 static inline void mput_char(char c, unsigned int num)
 {
        while(num--)
@@ -54,13 +48,9 @@ static void add_cmdname(const char *name, int len)
        struct cmdname *ent;
        if (cmdname_alloc <= cmdname_cnt) {
                cmdname_alloc = cmdname_alloc + 200;
-               cmdname = realloc(cmdname, cmdname_alloc * sizeof(*cmdname));
-               if (!cmdname)
-                       oom();
+               cmdname = xrealloc(cmdname, cmdname_alloc * sizeof(*cmdname));
        }
        ent = xmalloc(sizeof(*ent) + len);
-       if (!ent)
-               oom();
        ent->len = len;
        memcpy(ent->name, name, len);
        ent->name[len] = 0;