Skip to content

Commit 32bff61

Browse files
avargitster
authored andcommitted
refs: use designated initializers for "struct ref_storage_be"
Change the definition of the three refs backends we currently carry to use designated initializers. The "= NULL" assignments being retained here are redundant, and could be removed, but let's keep them for clarity. All of these backends define almost all fields, so we're not saving much in terms of line count by omitting these, but e.g. for "refs_be_debug" it's immediately apparent that we're omitting "init" when comparing its assignment to the others. This is a follow-up to similar work merged in bd4232f (Merge branch 'ab/struct-init', 2021-07-16), a4b9fb6 (Merge branch 'ab/designated-initializers-more', 2021-10-18) and a30321b (Merge branch 'ab/designated-initializers' into ab/designated-initializers-more, 2021-09-27). Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 74cc1aa commit 32bff61

File tree

3 files changed

+78
-78
lines changed

3 files changed

+78
-78
lines changed

refs/debug.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -418,30 +418,30 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
418418
}
419419

420420
struct ref_storage_be refs_be_debug = {
421-
NULL,
422-
"debug",
423-
NULL,
424-
debug_init_db,
425-
debug_transaction_prepare,
426-
debug_transaction_finish,
427-
debug_transaction_abort,
428-
debug_initial_transaction_commit,
429-
430-
debug_pack_refs,
431-
debug_create_symref,
432-
debug_delete_refs,
433-
debug_rename_ref,
434-
debug_copy_ref,
435-
436-
debug_ref_iterator_begin,
437-
debug_read_raw_ref,
438-
NULL,
439-
440-
debug_reflog_iterator_begin,
441-
debug_for_each_reflog_ent,
442-
debug_for_each_reflog_ent_reverse,
443-
debug_reflog_exists,
444-
debug_create_reflog,
445-
debug_delete_reflog,
446-
debug_reflog_expire,
421+
.next = NULL,
422+
.name = "debug",
423+
.init = NULL,
424+
.init_db = debug_init_db,
425+
.transaction_prepare = debug_transaction_prepare,
426+
.transaction_finish = debug_transaction_finish,
427+
.transaction_abort = debug_transaction_abort,
428+
.initial_transaction_commit = debug_initial_transaction_commit,
429+
430+
.pack_refs = debug_pack_refs,
431+
.create_symref = debug_create_symref,
432+
.delete_refs = debug_delete_refs,
433+
.rename_ref = debug_rename_ref,
434+
.copy_ref = debug_copy_ref,
435+
436+
.iterator_begin = debug_ref_iterator_begin,
437+
.read_raw_ref = debug_read_raw_ref,
438+
.read_symbolic_ref = NULL,
439+
440+
.reflog_iterator_begin = debug_reflog_iterator_begin,
441+
.for_each_reflog_ent = debug_for_each_reflog_ent,
442+
.for_each_reflog_ent_reverse = debug_for_each_reflog_ent_reverse,
443+
.reflog_exists = debug_reflog_exists,
444+
.create_reflog = debug_create_reflog,
445+
.delete_reflog = debug_delete_reflog,
446+
.reflog_expire = debug_reflog_expire,
447447
};

refs/files-backend.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,30 +3291,30 @@ static int files_init_db(struct ref_store *ref_store, struct strbuf *err)
32913291
}
32923292

32933293
struct ref_storage_be refs_be_files = {
3294-
NULL,
3295-
"files",
3296-
files_ref_store_create,
3297-
files_init_db,
3298-
files_transaction_prepare,
3299-
files_transaction_finish,
3300-
files_transaction_abort,
3301-
files_initial_transaction_commit,
3302-
3303-
files_pack_refs,
3304-
files_create_symref,
3305-
files_delete_refs,
3306-
files_rename_ref,
3307-
files_copy_ref,
3308-
3309-
files_ref_iterator_begin,
3310-
files_read_raw_ref,
3311-
files_read_symbolic_ref,
3312-
3313-
files_reflog_iterator_begin,
3314-
files_for_each_reflog_ent,
3315-
files_for_each_reflog_ent_reverse,
3316-
files_reflog_exists,
3317-
files_create_reflog,
3318-
files_delete_reflog,
3319-
files_reflog_expire
3294+
.next = NULL,
3295+
.name = "files",
3296+
.init = files_ref_store_create,
3297+
.init_db = files_init_db,
3298+
.transaction_prepare = files_transaction_prepare,
3299+
.transaction_finish = files_transaction_finish,
3300+
.transaction_abort = files_transaction_abort,
3301+
.initial_transaction_commit = files_initial_transaction_commit,
3302+
3303+
.pack_refs = files_pack_refs,
3304+
.create_symref = files_create_symref,
3305+
.delete_refs = files_delete_refs,
3306+
.rename_ref = files_rename_ref,
3307+
.copy_ref = files_copy_ref,
3308+
3309+
.iterator_begin = files_ref_iterator_begin,
3310+
.read_raw_ref = files_read_raw_ref,
3311+
.read_symbolic_ref = files_read_symbolic_ref,
3312+
3313+
.reflog_iterator_begin = files_reflog_iterator_begin,
3314+
.for_each_reflog_ent = files_for_each_reflog_ent,
3315+
.for_each_reflog_ent_reverse = files_for_each_reflog_ent_reverse,
3316+
.reflog_exists = files_reflog_exists,
3317+
.create_reflog = files_create_reflog,
3318+
.delete_reflog = files_delete_reflog,
3319+
.reflog_expire = files_reflog_expire
33203320
};

refs/packed-backend.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,30 +1667,30 @@ static int packed_reflog_expire(struct ref_store *ref_store,
16671667
}
16681668

16691669
struct ref_storage_be refs_be_packed = {
1670-
NULL,
1671-
"packed",
1672-
packed_ref_store_create,
1673-
packed_init_db,
1674-
packed_transaction_prepare,
1675-
packed_transaction_finish,
1676-
packed_transaction_abort,
1677-
packed_initial_transaction_commit,
1678-
1679-
packed_pack_refs,
1680-
packed_create_symref,
1681-
packed_delete_refs,
1682-
packed_rename_ref,
1683-
packed_copy_ref,
1684-
1685-
packed_ref_iterator_begin,
1686-
packed_read_raw_ref,
1687-
NULL,
1688-
1689-
packed_reflog_iterator_begin,
1690-
packed_for_each_reflog_ent,
1691-
packed_for_each_reflog_ent_reverse,
1692-
packed_reflog_exists,
1693-
packed_create_reflog,
1694-
packed_delete_reflog,
1695-
packed_reflog_expire
1670+
.next = NULL,
1671+
.name = "packed",
1672+
.init = packed_ref_store_create,
1673+
.init_db = packed_init_db,
1674+
.transaction_prepare = packed_transaction_prepare,
1675+
.transaction_finish = packed_transaction_finish,
1676+
.transaction_abort = packed_transaction_abort,
1677+
.initial_transaction_commit = packed_initial_transaction_commit,
1678+
1679+
.pack_refs = packed_pack_refs,
1680+
.create_symref = packed_create_symref,
1681+
.delete_refs = packed_delete_refs,
1682+
.rename_ref = packed_rename_ref,
1683+
.copy_ref = packed_copy_ref,
1684+
1685+
.iterator_begin = packed_ref_iterator_begin,
1686+
.read_raw_ref = packed_read_raw_ref,
1687+
.read_symbolic_ref = NULL,
1688+
1689+
.reflog_iterator_begin = packed_reflog_iterator_begin,
1690+
.for_each_reflog_ent = packed_for_each_reflog_ent,
1691+
.for_each_reflog_ent_reverse = packed_for_each_reflog_ent_reverse,
1692+
.reflog_exists = packed_reflog_exists,
1693+
.create_reflog = packed_create_reflog,
1694+
.delete_reflog = packed_delete_reflog,
1695+
.reflog_expire = packed_reflog_expire
16961696
};

0 commit comments

Comments
 (0)