refs.c: change resolve_ref_unsafe reading argument to be a flags field
[gitweb.git] / builtin / for-each-ref.c
index 69bba067189776d8411b1926084b53659799d0da..492265d9f9c6c0e60675945ad88f4a2fe0baa600 100644 (file)
@@ -138,10 +138,8 @@ static int parse_atom(const char *atom, const char *ep)
        /* Add it in, including the deref prefix */
        at = used_atom_cnt;
        used_atom_cnt++;
-       used_atom = xrealloc(used_atom,
-                            (sizeof *used_atom) * used_atom_cnt);
-       used_atom_type = xrealloc(used_atom_type,
-                                 (sizeof(*used_atom_type) * used_atom_cnt));
+       REALLOC_ARRAY(used_atom, used_atom_cnt);
+       REALLOC_ARRAY(used_atom_type, used_atom_cnt);
        used_atom[at] = xmemdupz(atom, ep - atom);
        used_atom_type[at] = valid_atom[i].cmp_type;
        if (*atom == '*')
@@ -637,7 +635,8 @@ static void populate_value(struct refinfo *ref)
 
        if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
                unsigned char unused1[20];
-               ref->symref = resolve_refdup(ref->refname, unused1, 1, NULL);
+               ref->symref = resolve_refdup(ref->refname, RESOLVE_REF_READING,
+                                            unused1, NULL);
                if (!ref->symref)
                        ref->symref = "";
        }
@@ -695,7 +694,8 @@ static void populate_value(struct refinfo *ref)
                        const char *head;
                        unsigned char sha1[20];
 
-                       head = resolve_ref_unsafe("HEAD", sha1, 1, NULL);
+                       head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
+                                                 sha1, NULL);
                        if (!strcmp(ref->refname, head))
                                v->s = "*";
                        else
@@ -870,8 +870,7 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f
        ref->flag = flag;
 
        cnt = cb->grab_cnt;
-       cb->grab_array = xrealloc(cb->grab_array,
-                                 sizeof(*cb->grab_array) * (cnt + 1));
+       REALLOC_ARRAY(cb->grab_array, cnt + 1);
        cb->grab_array[cnt++] = ref;
        cb->grab_cnt = cnt;
        return 0;