Merge branch 'mm/log-branch-desc-plug-leak'
[gitweb.git] / builtin / for-each-ref.c
index 51798b48b54266fccd2f7b4687646d152ab70588..47bd624696d5e94295dda8846f00dcbb80a6ca5a 100644 (file)
@@ -193,7 +193,7 @@ static int verify_format(const char *format)
                at = parse_atom(sp + 2, ep);
                cp = ep + 1;
 
-               if (!memcmp(used_atom[at], "color:", 6))
+               if (starts_with(used_atom[at], "color:"))
                        need_color_reset_at_eol = !!strcmp(used_atom[at], color_reset);
        }
        return 0;
@@ -283,18 +283,6 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
        }
 }
 
-static int num_parents(struct commit *commit)
-{
-       struct commit_list *parents;
-       int i;
-
-       for (i = 0, parents = commit->parents;
-            parents;
-            parents = parents->next)
-               i++;
-       return i;
-}
-
 /* See grab_values */
 static void grab_commit_values(struct atom_value *val, int deref, struct object *obj, void *buf, unsigned long sz)
 {
@@ -315,12 +303,12 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
                }
                if (!strcmp(name, "numparent")) {
                        char *s = xmalloc(40);
-                       v->ul = num_parents(commit);
+                       v->ul = commit_list_count(commit->parents);
                        sprintf(s, "%lu", v->ul);
                        v->s = s;
                }
                else if (!strcmp(name, "parent")) {
-                       int num = num_parents(commit);
+                       int num = commit_list_count(commit->parents);
                        int i;
                        struct commit_list *parents;
                        char *s = xmalloc(41 * num + 1);
@@ -864,7 +852,7 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f
                             refname[plen] == '/' ||
                             p[plen-1] == '/'))
                                break;
-                       if (!fnmatch(p, refname, FNM_PATHNAME))
+                       if (!wildmatch(p, refname, WM_PATHNAME, NULL))
                                break;
                }
                if (!*pattern)