*.h _INIT macros: don't specify fields equal to 0
Change the initialization of "struct strbuf" changed in cbc0f81d96f (strbuf: use designated initializers in STRBUF_INIT, 2017-07-10) to omit specifying "alloc" and "len", as we do with other "alloc" and "len" (or "nr") in similar structs. Let's likewise omit the explicit initialization of all fields in the "struct ipc_client_connect_option" struct added in 59c7b88198a (simple-ipc: add win32 implementation, 2021-03-15). Do the same for a few other initializers, e.g. STRVEC_INIT and CACHE_DEF_INIT. Finally, start incrementally changing the same pattern in "t/helper/test-run-command.c". This change was part of an earlier on-list version[1] of c90be786da9 (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:
parent
9865b6e6a4
commit
608cfd31cf
2
cache.h
2
cache.h
@ -1668,7 +1668,7 @@ struct cache_def {
|
|||||||
int track_flags;
|
int track_flags;
|
||||||
int prefix_len_stat_func;
|
int prefix_len_stat_func;
|
||||||
};
|
};
|
||||||
#define CACHE_DEF_INIT { STRBUF_INIT, 0, 0, 0 }
|
#define CACHE_DEF_INIT { STRBUF_INIT }
|
||||||
static inline void cache_def_clear(struct cache_def *cache)
|
static inline void cache_def_clear(struct cache_def *cache)
|
||||||
{
|
{
|
||||||
strbuf_release(&cache->path);
|
strbuf_release(&cache->path);
|
||||||
|
@ -65,11 +65,7 @@ struct ipc_client_connect_options {
|
|||||||
unsigned int uds_disallow_chdir:1;
|
unsigned int uds_disallow_chdir:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IPC_CLIENT_CONNECT_OPTIONS_INIT { \
|
#define IPC_CLIENT_CONNECT_OPTIONS_INIT { 0 }
|
||||||
.wait_if_busy = 0, \
|
|
||||||
.wait_if_not_found = 0, \
|
|
||||||
.uds_disallow_chdir = 0, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine if a server is listening on this named pipe or socket using
|
* Determine if a server is listening on this named pipe or socket using
|
||||||
|
2
strbuf.h
2
strbuf.h
@ -70,7 +70,7 @@ struct strbuf {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern char strbuf_slopbuf[];
|
extern char strbuf_slopbuf[];
|
||||||
#define STRBUF_INIT { .alloc = 0, .len = 0, .buf = strbuf_slopbuf }
|
#define STRBUF_INIT { .buf = strbuf_slopbuf }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Predeclare this here, since cache.h includes this file before it defines the
|
* Predeclare this here, since cache.h includes this file before it defines the
|
||||||
|
2
strvec.h
2
strvec.h
@ -33,7 +33,7 @@ struct strvec {
|
|||||||
size_t alloc;
|
size_t alloc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STRVEC_INIT { empty_strvec, 0, 0 }
|
#define STRVEC_INIT { empty_strvec }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an array. This is no different than assigning from
|
* Initialize an array. This is no different than assigning from
|
||||||
|
@ -37,7 +37,7 @@ struct submodule_update_strategy {
|
|||||||
enum submodule_update_type type;
|
enum submodule_update_type type;
|
||||||
const char *command;
|
const char *command;
|
||||||
};
|
};
|
||||||
#define SUBMODULE_UPDATE_STRATEGY_INIT {SM_UPDATE_UNSPECIFIED, NULL}
|
#define SUBMODULE_UPDATE_STRATEGY_INIT {SM_UPDATE_UNSPECIFIED}
|
||||||
|
|
||||||
int is_gitmodules_unmerged(struct index_state *istate);
|
int is_gitmodules_unmerged(struct index_state *istate);
|
||||||
int is_writing_gitmodules_ok(void);
|
int is_writing_gitmodules_ok(void);
|
||||||
|
@ -61,7 +61,7 @@ struct testsuite {
|
|||||||
int quiet, immediate, verbose, verbose_log, trace, write_junit_xml;
|
int quiet, immediate, verbose, verbose_log, trace, write_junit_xml;
|
||||||
};
|
};
|
||||||
#define TESTSUITE_INIT \
|
#define TESTSUITE_INIT \
|
||||||
{ STRING_LIST_INIT_DUP, STRING_LIST_INIT_DUP, 0, 0, 0, 0, 0, 0, 0 }
|
{ STRING_LIST_INIT_DUP, STRING_LIST_INIT_DUP }
|
||||||
|
|
||||||
static int next_test(struct child_process *cp, struct strbuf *err, void *cb,
|
static int next_test(struct child_process *cp, struct strbuf *err, void *cb,
|
||||||
void **task_cb)
|
void **task_cb)
|
||||||
|
2
trace.h
2
trace.h
@ -89,7 +89,7 @@ struct trace_key {
|
|||||||
|
|
||||||
extern struct trace_key trace_default_key;
|
extern struct trace_key trace_default_key;
|
||||||
|
|
||||||
#define TRACE_KEY_INIT(name) { "GIT_TRACE_" #name, 0, 0, 0 }
|
#define TRACE_KEY_INIT(name) { "GIT_TRACE_" #name }
|
||||||
extern struct trace_key trace_perf_key;
|
extern struct trace_key trace_perf_key;
|
||||||
extern struct trace_key trace_setup_key;
|
extern struct trace_key trace_setup_key;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user