diff options
Diffstat (limited to 'refs')
-rw-r--r-- | refs/files-backend.c | 14 | ||||
-rw-r--r-- | refs/iterator.c | 2 | ||||
-rw-r--r-- | refs/packed-backend.c | 4 | ||||
-rw-r--r-- | refs/ref-cache.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index 04e85e7002..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; @@ -1824,12 +1824,12 @@ static int create_symref_locked(struct files_ref_store *refs, if (!fdopen_lock_file(&lock->lk, "w")) return error("unable to fdopen %s: %s", - lock->lk.tempfile->filename.buf, strerror(errno)); + get_lock_file_path(&lock->lk), strerror(errno)); update_symref_reflog(refs, lock, refname, target, logmsg); /* no error check; commit_ref will check ferror */ - fprintf(lock->lk.tempfile->fp, "ref: %s\n", target); + fprintf(get_lock_file_fp(&lock->lk), "ref: %s\n", target); if (commit_ref(lock) < 0) return error("unable to write symref for %s: %s", refname, strerror(errno)); @@ -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; /* diff --git a/refs/iterator.c b/refs/iterator.c index 629e00a122..a89d132d4f 100644 --- a/refs/iterator.c +++ b/refs/iterator.c @@ -393,7 +393,7 @@ struct ref_iterator *prefix_ref_iterator_begin(struct ref_iterator *iter0, if (!*prefix && !trim) return iter0; /* optimization: no need to wrap iterator */ - iter = xcalloc(1, sizeof(*iter)); + CALLOC_ARRAY(iter, 1); ref_iterator = &iter->base; base_ref_iterator_init(ref_iterator, &prefix_ref_iterator_vtable, iter0->ordered); diff --git a/refs/packed-backend.c b/refs/packed-backend.c index b912f2505f..dfecdbc1db 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -941,7 +941,7 @@ static struct ref_iterator *packed_ref_iterator_begin( if (start == snapshot->eof) return empty_ref_iterator_begin(); - iter = xcalloc(1, sizeof(*iter)); + CALLOC_ARRAY(iter, 1); ref_iterator = &iter->base; base_ref_iterator_init(ref_iterator, &packed_ref_iterator_vtable, 1); @@ -1424,7 +1424,7 @@ static int packed_transaction_prepare(struct ref_store *ref_store, * do so itself. */ - data = xcalloc(1, sizeof(*data)); + CALLOC_ARRAY(data, 1); string_list_init(&data->updates, 0); transaction->backend_data = data; diff --git a/refs/ref-cache.c b/refs/ref-cache.c index b7052f72e2..46f1e54284 100644 --- a/refs/ref-cache.c +++ b/refs/ref-cache.c @@ -530,7 +530,7 @@ struct ref_iterator *cache_ref_iterator_begin(struct ref_cache *cache, if (prime_dir) prime_ref_dir(dir, prefix); - iter = xcalloc(1, sizeof(*iter)); + CALLOC_ARRAY(iter, 1); ref_iterator = &iter->base; base_ref_iterator_init(ref_iterator, &cache_ref_iterator_vtable, 1); ALLOC_GROW(iter->levels, 10, iter->levels_alloc); |