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--)
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;
struct stat st;
int entlen;
- if (strncmp(de->d_name, "git-", 4))
+ if (prefixcmp(de->d_name, "git-"))
continue;
strcpy(path+dirlen, de->d_name);
if (stat(path, &st) || /* stat, not lstat */
{
const char *page;
- if (!strncmp(git_cmd, "git", 3))
+ if (!prefixcmp(git_cmd, "git"))
page = git_cmd;
else {
int page_len = strlen(git_cmd) + 4;
return 0;
}
-
-