mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
*.h: move some *_INIT to designated initializers
Move various *_INIT macros to use designated initializers. This helps
readability. I've only picked those leftover macros that were not
touched by another in-flight series of mine which changed others, but
also how initialization was done.
In the case of SUBMODULE_ALTERNATE_SETUP_INIT I've left an explicit
initialization of "error_mode", even though
SUBMODULE_ALTERNATE_ERROR_IGNORE itself is defined as "0". Let's not
peek under the hood and assume that enum fields we know the value of
will stay at "0".
The change to "TESTSUITE_INIT" in "t/helper/test-run-command.c" was
part of an earlier on-list version[1] of c90be786da (test-tool
run-command: fix flip-flop init pattern, 2021-09-11).
1. https://lore.kernel.org/git/patch-1.1-0aa4523ab6e-20210909T130849Z-avarab@gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
608cfd31cf
commit
f69a6e4f07
5
list.h
5
list.h
@@ -46,7 +46,10 @@ struct list_head {
|
||||
#define INIT_LIST_HEAD(ptr) \
|
||||
(ptr)->next = (ptr)->prev = (ptr)
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
#define LIST_HEAD_INIT(name) { \
|
||||
.next = &(name), \
|
||||
.prev = &(name), \
|
||||
}
|
||||
|
||||
/* Add new element at the head of the list. */
|
||||
static inline void list_add(struct list_head *newp, struct list_head *head)
|
||||
|
||||
Reference in New Issue
Block a user