]> git.ipfire.org Git - thirdparty/git.git/commitdiff
notes.c: use designated initializers for clarity
authorTeng Long <dyroneteng@gmail.com>
Sat, 27 May 2023 07:57:49 +0000 (15:57 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Jun 2023 15:51:00 +0000 (08:51 -0700)
The "struct note_data d = { 0, 0, NULL, STRBUF_INIT };" style could be
replaced with designated initializer for clarity.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c

index c501c6eebbce0bf7fc0fc487f814dcbe2b50f9f7..9d8ca795827af25a9a3a90ba5b59fed73a37a886 100644 (file)
@@ -405,7 +405,7 @@ static int add(int argc, const char **argv, const char *prefix)
        struct notes_tree *t;
        struct object_id object, new_note;
        const struct object_id *note;
-       struct note_data d = { 0, 0, NULL, STRBUF_INIT };
+       struct note_data d = { .buf = STRBUF_INIT };
        struct option options[] = {
                OPT_CALLBACK_F('m', "message", &d, N_("message"),
                        N_("note contents as a string"), PARSE_OPT_NONEG,
@@ -571,7 +571,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)
        const struct object_id *note;
        char *logmsg;
        const char * const *usage;
-       struct note_data d = { 0, 0, NULL, STRBUF_INIT };
+       struct note_data d = { .buf = STRBUF_INIT };
        struct option options[] = {
                OPT_CALLBACK_F('m', "message", &d, N_("message"),
                        N_("note contents as a string"), PARSE_OPT_NONEG,