diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-07-01 12:51:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-07-01 12:32:22 -0700 |
commit | 770fedaf9fb156bd8c18da41770eac0cb63fba63 (patch) | |
tree | 7187ab68ef185ddc2f5351764e9dafa4ee6e2f2e /apply.c | |
parent | dir.[ch]: replace dir_init() with DIR_INIT (diff) | |
download | tgif-770fedaf9fb156bd8c18da41770eac0cb63fba63.tar.xz |
string-list.[ch]: add a string_list_init_{nodup,dup}()
In order to use the new "memcpy() a 'blank' struct on the stack"
pattern for string_list_init(), and to make the macro initialization
consistent with the function initialization introduce two new
string_list_init_{nodup,dup}() functions. These are like the old
string_list_init() when called with a false and true second argument,
respectively.
I think this not only makes things more consistent, but also easier to
read. I often had to lookup what the ", 0)" or ", 1)" in these
invocations meant, now it's right there in the function name, and
corresponds to the macros.
A subsequent commit will convert existing API users to this pattern,
but as this is a very common API let's leave a compatibility function
in place for later removal. This intermediate state also proves that
the compatibility function works.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'apply.c')
0 files changed, 0 insertions, 0 deletions