summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeng Long <dyroneteng@gmail.com>2022-11-09 17:06:53 +0800
committerTaylor Blau <me@ttaylorr.com>2022-11-09 21:43:16 -0500
commitd8d795a5d3448a9a97f680c83834b9592b50dee1 (patch)
tree7d97a7ea21f3a488e14758cc3889cad0c9d15599
parenteb792138075762bf41f9dea0bd56d0262cdcf506 (diff)
downloadgit-d8d795a5d3448a9a97f680c83834b9592b50dee1.tar.gz
notes.c: cleanup for "designated init" and "char ptr init"
Let's do some cleanup for the following two places in "append_edit()". The first place is "char *logmsg;" need to be initialized with NULL. The second place is "struct note_data d = { 0, 0, NULL, STRBUF_INIT };" could be replaced with designated init format. Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
-rw-r--r--builtin/notes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index f4bab3b2f2..485439c901 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -566,9 +566,9 @@ static int append_edit(int argc, const char **argv, const char *prefix)
struct notes_tree *t;
struct object_id object, new_note;
const struct object_id *note;
- char *logmsg;
+ char *logmsg = NULL;
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,