]> git.ipfire.org Git - thirdparty/git.git/commitdiff
*.h: move some *_INIT to designated initializers
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 1 Jul 2021 10:51:25 +0000 (12:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Jul 2021 19:31:45 +0000 (12:31 -0700)
Move *_INIT macros I'll use in a subsequent commits to designated
initializers. This isn't required for those follow-up changes, but
since next commits will change things in this area, let's use the
modern pattern over the old one while we're at it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
credential.h
json-writer.h
run-command.h
string-list.h

index c0e17e3554fce30586abe8a32aad503e4ec92b03..f430e77fea4869ea98156add3956e15a9fc94755 100644 (file)
@@ -128,7 +128,9 @@ struct credential {
        char *path;
 };
 
-#define CREDENTIAL_INIT { STRING_LIST_INIT_DUP }
+#define CREDENTIAL_INIT { \
+       .helpers = STRING_LIST_INIT_DUP, \
+}
 
 /* Initialize a credential structure, setting all fields to empty. */
 void credential_init(struct credential *);
index 83906b09c173894111383b3fc3a0ec7e398373c7..209355e0f12ce296c120b5e5b9f1651a2daf311f 100644 (file)
@@ -64,7 +64,10 @@ struct json_writer
        unsigned int pretty:1;
 };
 
-#define JSON_WRITER_INIT { STRBUF_INIT, STRBUF_INIT, 0, 0 }
+#define JSON_WRITER_INIT { \
+       .json = STRBUF_INIT, \
+       .open_stack = STRBUF_INIT, \
+}
 
 void jw_init(struct json_writer *jw);
 void jw_release(struct json_writer *jw);
index d08414a92e734c8b0768b4dc142be8508d522d0d..62a922d23fb6e96d2bfd6753beeb4c8643cba8c2 100644 (file)
@@ -141,7 +141,10 @@ struct child_process {
        void *clean_on_exit_handler_cbdata;
 };
 
-#define CHILD_PROCESS_INIT { NULL, STRVEC_INIT, STRVEC_INIT }
+#define CHILD_PROCESS_INIT { \
+       .args = STRVEC_INIT, \
+       .env_array = STRVEC_INIT, \
+}
 
 /**
  * The functions: child_process_init, start_command, finish_command,
index 6c5d274126ac6c5e1b796f0a33fb33fba3ebda2a..521b9c0748ddcc192009984628fd83f46dc192d7 100644 (file)
@@ -91,8 +91,8 @@ struct string_list {
        compare_strings_fn cmp; /* NULL uses strcmp() */
 };
 
-#define STRING_LIST_INIT_NODUP { NULL, 0, 0, 0, NULL }
-#define STRING_LIST_INIT_DUP   { NULL, 0, 0, 1, NULL }
+#define STRING_LIST_INIT_NODUP { 0 }
+#define STRING_LIST_INIT_DUP   { .strdup_strings = 1 }
 
 /* General functions which work with both sorted and unsorted lists. */