X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=help.c;h=e5662d9014e758fee00b890e06ffc66cd4aa0291;hb=e2b7eaf0ca3897940961d23392d4ff718867ea9f;hp=0893fea0254f4ec8acbce82a0af41e4e61bd72a6;hpb=aa576e6b47d8e20d0d56d0e9f9fc2ecce5bae1e1;p=git.git diff --git a/help.c b/help.c index 0893fea02..e5662d901 100644 --- 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 = malloc(sizeof(*ent) + len); - if (!ent) - oom(); + ent = xmalloc(sizeof(*ent) + len); ent->len = len; memcpy(ent->name, name, len); ent->name[len] = 0; @@ -195,8 +185,7 @@ static void show_man_page(const char *git_cmd) void help_unknown_cmd(const char *cmd) { - printf("git: '%s' is not a git-command\n\n", cmd); - list_common_cmds_help(); + fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd); exit(1); } @@ -229,5 +218,3 @@ int cmd_help(int argc, const char **argv, const char *prefix) return 0; } - -