diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-03-19 15:25:38 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-03-19 15:25:38 -0700 |
| commit | 92ccd7b7529a852583c5033ba28b4414cd2f7654 (patch) | |
| tree | bce1548bcd2cd806a4524b812fb56f19b397b7d2 /refs/files-backend.c | |
| parent | Merge branch 'rs/avoid-null-statement-after-macro-call' (diff) | |
| parent | cocci: allow xcalloc(1, size) (diff) | |
| download | git-92ccd7b7529a852583c5033ba28b4414cd2f7654.tar.gz git-92ccd7b7529a852583c5033ba28b4414cd2f7654.zip | |
Merge branch 'rs/calloc-array'
CALLOC_ARRAY() macro replaces many uses of xcalloc().
* rs/calloc-array:
cocci: allow xcalloc(1, size)
use CALLOC_ARRAY
git-compat-util.h: drop trailing semicolon from macro definition
Diffstat (limited to 'refs/files-backend.c')
| -rw-r--r-- | refs/files-backend.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index 4fdc68810b..119972ee16 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -549,7 +549,7 @@ static int lock_raw_ref(struct files_ref_store *refs, /* First lock the file so it can't change out from under us. */ - *lock_p = lock = xcalloc(1, sizeof(*lock)); + *lock_p = CALLOC_ARRAY(lock, 1); lock->ref_name = xstrdup(refname); files_ref_path(refs, &ref_file, refname); @@ -843,7 +843,7 @@ static struct ref_iterator *files_ref_iterator_begin( overlay_iter = overlay_ref_iterator_begin(loose_iter, packed_iter); - iter = xcalloc(1, sizeof(*iter)); + CALLOC_ARRAY(iter, 1); ref_iterator = &iter->base; base_ref_iterator_init(ref_iterator, &files_ref_iterator_vtable, overlay_iter->ordered); @@ -930,7 +930,7 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs, files_assert_main_repository(refs, "lock_ref_oid_basic"); assert(err); - lock = xcalloc(1, sizeof(struct ref_lock)); + CALLOC_ARRAY(lock, 1); if (mustexist) resolve_flags |= RESOLVE_REF_READING; @@ -2152,7 +2152,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store, return empty_ref_iterator_begin(); } - iter = xcalloc(1, sizeof(*iter)); + CALLOC_ARRAY(iter, 1); ref_iterator = &iter->base; base_ref_iterator_init(ref_iterator, &files_reflog_iterator_vtable, 0); @@ -2597,7 +2597,7 @@ static int files_transaction_prepare(struct ref_store *ref_store, if (!transaction->nr) goto cleanup; - backend_data = xcalloc(1, sizeof(*backend_data)); + CALLOC_ARRAY(backend_data, 1); transaction->backend_data = backend_data; /* |
