diff options
author | René Scharfe <l.s.r@web.de> | 2021-03-13 17:17:22 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-13 16:00:09 -0800 |
commit | ca56dadb4b65ccaeab809d80db80a312dc00941a (patch) | |
tree | fa027eb80d076ebf7be7c3ea69a92cf47e594a1c /resolve-undo.c | |
parent | f1121499e6460e814ec3cffa0b18942ac529f768 (diff) | |
download | git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.gz |
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 'resolve-undo.c')
-rw-r--r-- | resolve-undo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/resolve-undo.c b/resolve-undo.c index 236320f179..bbd2e57fe4 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -15,7 +15,7 @@ void record_resolve_undo(struct index_state *istate, struct cache_entry *ce) return; if (!istate->resolve_undo) { - resolve_undo = xcalloc(1, sizeof(*resolve_undo)); + CALLOC_ARRAY(resolve_undo, 1); resolve_undo->strdup_strings = 1; istate->resolve_undo = resolve_undo; } @@ -57,7 +57,7 @@ struct string_list *resolve_undo_read(const char *data, unsigned long size) int i; const unsigned rawsz = the_hash_algo->rawsz; - resolve_undo = xcalloc(1, sizeof(*resolve_undo)); + CALLOC_ARRAY(resolve_undo, 1); resolve_undo->strdup_strings = 1; while (size) { |