Thread (28 messages) flat view 28 messages, 2 authors, 2021-10-02
STALE1801d

Revision v1 of 4 in this series.

Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH 3/6] shortlog: use designated initializer for "struct shortlog"

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-09-27 00:53:31
Subsystem: the rest · Maintainer: Linus Torvalds

Change code added in 64093fc06a (blame,shortlog: don't make local
option variables static, 2016-06-13) to use a designated initializer
via a typical *_INIT macro pattern.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/shortlog.c | 2 +-
 shortlog.h         | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 3e7ab1ca821..fa1f76cc51e 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -342,7 +342,7 @@ void shortlog_init(struct shortlog *log)
 
 int cmd_shortlog(int argc, const char **argv, const char *prefix)
 {
-	struct shortlog log = { STRING_LIST_INIT_NODUP };
+	struct shortlog log = SHORTLOG_INIT;
 	struct rev_info rev;
 	int nongit = !startup_info->have_repository;
 
diff --git a/shortlog.h b/shortlog.h
index 3f7e9aabcae..47892d6d604 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -28,6 +28,10 @@ struct shortlog {
 	FILE *file;
 };
 
+#define SHORTLOG_INIT { \
+	.list = STRING_LIST_INIT_NODUP, \
+}
+
 void shortlog_init(struct shortlog *log);
 
 void shortlog_add_commit(struct shortlog *log, struct commit *commit);
-- 
2.33.0.1316.gb2e9b3ba3ae
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help