gitweb: Add snapshot to shortlog
[gitweb.git] / builtin-show-branch.c
index 2a1b848f6c169f09cb168d12e6bb5033795b8be2..578c9fafd022ce8a8676d348120c2fc7b2b1c5dd 100644 (file)
@@ -8,9 +8,9 @@
 static const char show_branch_usage[] =
 "git-show-branch [--sparse] [--current] [--all] [--heads] [--tags] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...]";
 
-static int default_num = 0;
-static int default_alloc = 0;
-static const char **default_arg = NULL;
+static int default_num;
+static int default_alloc;
+static const char **default_arg;
 
 #define UNINTERESTING  01
 
@@ -163,7 +163,7 @@ static void name_commits(struct commit_list *list,
                                        en += sprintf(en, "^");
                                else
                                        en += sprintf(en, "^%d", nth);
-                               name_commit(p, strdup(newname), 0);
+                               name_commit(p, xstrdup(newname), 0);
                                i++;
                                name_first_parent_chain(p);
                        }
@@ -261,7 +261,7 @@ static void show_one_commit(struct commit *commit, int no_name)
        struct commit_name *name = commit->util;
        if (commit->object.parsed)
                pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
-                                   pretty, sizeof(pretty), 0, NULL, NULL);
+                                   pretty, sizeof(pretty), 0, NULL, NULL, 0);
        else
                strcpy(pretty, "(unavailable)");
        if (!strncmp(pretty, "[PATCH] ", 8))
@@ -364,7 +364,7 @@ static int append_ref(const char *refname, const unsigned char *sha1)
                        refname, MAX_REVS);
                return 0;
        }
-       ref_name[ref_name_cnt++] = strdup(refname);
+       ref_name[ref_name_cnt++] = xstrdup(refname);
        ref_name[ref_name_cnt] = NULL;
        return 0;
 }
@@ -378,7 +378,7 @@ static int append_head_ref(const char *refname, const unsigned char *sha1)
        /* If both heads/foo and tags/foo exists, get_sha1 would
         * get confused.
         */
-       if (get_sha1(refname + ofs, tmp) || memcmp(tmp, sha1, 20))
+       if (get_sha1(refname + ofs, tmp) || hashcmp(tmp, sha1))
                ofs = 5;
        return append_ref(refname + ofs, sha1);
 }
@@ -442,7 +442,7 @@ static int rev_is_head(char *head_path, int headlen, char *name,
 {
        int namelen;
        if ((!head_path[0]) ||
-           (head_sha1 && sha1 && memcmp(head_sha1, sha1, 20)))
+           (head_sha1 && sha1 && hashcmp(head_sha1, sha1)))
                return 0;
        namelen = strlen(name);
        if ((headlen < namelen) ||
@@ -521,7 +521,7 @@ static int git_show_branch_config(const char *var, const char *value)
                        default_alloc = default_alloc * 3 / 2 + 20;
                        default_arg = xrealloc(default_arg, sizeof *default_arg * default_alloc);
                }
-               default_arg[default_num++] = strdup(value);
+               default_arg[default_num++] = xstrdup(value);
                default_arg[default_num] = NULL;
                return 0;
        }