summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-03-13 16:17:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-14 00:00:09 (GMT)
commitca56dadb4b65ccaeab809d80db80a312dc00941a (patch)
treefa027eb80d076ebf7be7c3ea69a92cf47e594a1c /refs.c
parentf1121499e6460e814ec3cffa0b18942ac529f768 (diff)
downloadgit-ca56dadb4b65ccaeab809d80db80a312dc00941a.zip
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.gz
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.bz2
use CALLOC_ARRAY
Add and apply a semantic patch for converting code that open-codes CALLOC_ARRAY to use it instead. It shortens the code and infers the element size automatically. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index a665ed5..261fd82 100644
--- a/refs.c
+++ b/refs.c
@@ -1007,7 +1007,7 @@ struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
struct ref_transaction *tr;
assert(err);
- tr = xcalloc(1, sizeof(struct ref_transaction));
+ CALLOC_ARRAY(tr, 1);
tr->ref_store = refs;
return tr;
}
@@ -1306,7 +1306,7 @@ int parse_hide_refs_config(const char *var, const char *value, const char *secti
while (len && ref[len - 1] == '/')
ref[--len] = '\0';
if (!hide_refs) {
- hide_refs = xcalloc(1, sizeof(*hide_refs));
+ CALLOC_ARRAY(hide_refs, 1);
hide_refs->strdup_strings = 1;
}
string_list_append(hide_refs, ref);