refs.c: let fprintf handle the formatting
[gitweb.git] / walker.c
index f8d370913a8dcfb87d62ab994b4823dc84157f8b..f149371e71ebdcdbd12336aace15b0fc20f74569 100644 (file)
--- a/walker.c
+++ b/walker.c
@@ -228,8 +228,8 @@ int walker_targets_stdin(char ***target, const char ***write_ref)
 
                if (targets >= targets_alloc) {
                        targets_alloc = targets_alloc ? targets_alloc * 2 : 64;
-                       *target = xrealloc(*target, targets_alloc * sizeof(**target));
-                       *write_ref = xrealloc(*write_ref, targets_alloc * sizeof(**write_ref));
+                       REALLOC_ARRAY(*target, targets_alloc);
+                       REALLOC_ARRAY(*write_ref, targets_alloc);
                }
                (*target)[targets] = xstrdup(tg_one);
                (*write_ref)[targets] = rf_one ? xstrdup(rf_one) : NULL;
@@ -300,14 +300,13 @@ int walker_fetch(struct walker *walker, int targets, char **target,
                strbuf_addf(&refname, "refs/%s", write_ref[i]);
                if (ref_transaction_update(transaction, refname.buf,
                                           &sha1[20 * i], NULL, 0, 0,
+                                          msg ? msg : "fetch (unknown)",
                                           &err)) {
                        error("%s", err.buf);
                        goto done;
                }
        }
-       if (ref_transaction_commit(transaction,
-                                  msg ? msg : "fetch (unknown)",
-                                  &err)) {
+       if (ref_transaction_commit(transaction, &err)) {
                error("%s", err.buf);
                goto done;
        }