git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Martin Ågren" <martin.agren@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 3/5] *.h _INIT macros: don't specify fields equal to 0
Date: Mon, 27 Sep 2021 02:39:50 +0200	[thread overview]
Message-ID: <patch-3.5-9e45d2e7bb3-20210927T003330Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-0.5-00000000000-20210927T003330Z-avarab@gmail.com>

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).

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>
---
 simple-ipc.h                | 6 +-----
 strbuf.h                    | 2 +-
 t/helper/test-run-command.c | 2 +-
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/simple-ipc.h b/simple-ipc.h
index 2c48a5ee004..08b2908d5f8 100644
--- a/simple-ipc.h
+++ b/simple-ipc.h
@@ -65,11 +65,7 @@ struct ipc_client_connect_options {
 	unsigned int uds_disallow_chdir:1;
 };
 
-#define IPC_CLIENT_CONNECT_OPTIONS_INIT { \
-	.wait_if_busy = 0, \
-	.wait_if_not_found = 0, \
-	.uds_disallow_chdir = 0, \
-}
+#define IPC_CLIENT_CONNECT_OPTIONS_INIT { 0 }
 
 /*
  * Determine if a server is listening on this named pipe or socket using
diff --git a/strbuf.h b/strbuf.h
index 5b1113abf8f..3b36bbc49f0 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -70,7 +70,7 @@ struct strbuf {
 };
 
 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
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 14c57365e76..50bb98b7e04 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -61,7 +61,7 @@ struct testsuite {
 	int quiet, immediate, verbose, verbose_log, trace, write_junit_xml;
 };
 #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,
 		     void **task_cb)
-- 
2.33.0.1294.g2bdf2798764


  parent reply	other threads:[~2021-09-27  0:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27  0:39 [PATCH 0/5] Designated initializer cleanup & conversion Ævar Arnfjörð Bjarmason
2021-09-27  0:39 ` [PATCH 1/5] submodule-config.h: remove unused SUBMODULE_INIT macro Ævar Arnfjörð Bjarmason
2021-09-27  0:39 ` [PATCH 2/5] *.[ch] *_INIT macros: use { 0 } for a "zero out" idiom Ævar Arnfjörð Bjarmason
2021-09-27  2:27   ` Eric Sunshine
2021-09-27  6:35   ` Johannes Sixt
2021-09-27 20:25     ` Junio C Hamano
2021-09-27  0:39 ` Ævar Arnfjörð Bjarmason [this message]
2021-09-27  0:39 ` [PATCH 4/5] *.h: move some *_INIT to designated initializers Ævar Arnfjörð Bjarmason
2021-09-27  0:39 ` [PATCH 5/5] cbtree.h: define cb_init() in terms of CBTREE_INIT Ævar Arnfjörð Bjarmason
2021-09-27  6:37   ` Johannes Sixt
2021-09-27 11:02     ` Ævar Arnfjörð Bjarmason
2021-09-27 23:54       ` Jeff King
2021-09-28  6:15         ` Johannes Sixt
2021-09-28 18:32         ` Junio C Hamano
2021-09-28 19:42           ` Ævar Arnfjörð Bjarmason
2021-09-28 20:50             ` Junio C Hamano
2021-09-27  9:13   ` Phillip Wood
2021-09-27 11:00     ` Ævar Arnfjörð Bjarmason
2021-09-30 10:01       ` Phillip Wood
2021-09-27 12:54 ` [PATCH v2 0/5] Designated initializer cleanup & conversion Ævar Arnfjörð Bjarmason
2021-09-27 12:54   ` [PATCH v2 1/5] submodule-config.h: remove unused SUBMODULE_INIT macro Ævar Arnfjörð Bjarmason
2021-09-27 23:34     ` Jeff King
2021-09-27 12:54   ` [PATCH v2 2/5] *.[ch] *_INIT macros: use { 0 } for a "zero out" idiom Ævar Arnfjörð Bjarmason
2021-09-27 23:24     ` Jeff King
2021-09-28  0:25       ` Ævar Arnfjörð Bjarmason
2021-09-28  0:46         ` Jeff King
2021-09-28  1:44         ` Ramsay Jones
2021-09-27 12:54   ` [PATCH v2 3/5] *.h _INIT macros: don't specify fields equal to 0 Ævar Arnfjörð Bjarmason
2021-09-27 21:54     ` Junio C Hamano
2021-09-27 12:54   ` [PATCH v2 4/5] *.h: move some *_INIT to designated initializers Ævar Arnfjörð Bjarmason
2021-09-27 23:57     ` Junio C Hamano
2021-09-27 12:54   ` [PATCH v2 5/5] cbtree.h: define cb_init() in terms of CBTREE_INIT Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-3.5-9e45d2e7bb3-20210927T003330Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martin.agren@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).