summaryrefslogtreecommitdiff
path: root/string-list.h
diff options
context:
space:
mode:
authorTanay Abhra <tanayabh@gmail.com>2014-06-03 09:13:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-06 20:49:19 (GMT)
commitacb3d22264fd3736f95f71aa38e1d6fa01f5e9e1 (patch)
tree0917dd95d20ff60df790ac5c2e53ee37838bad53 /string-list.h
parente156455ea49124c140a67623f22a393db62d5d98 (diff)
downloadgit-acb3d22264fd3736f95f71aa38e1d6fa01f5e9e1.zip
git-acb3d22264fd3736f95f71aa38e1d6fa01f5e9e1.tar.gz
git-acb3d22264fd3736f95f71aa38e1d6fa01f5e9e1.tar.bz2
string-list: spell all values out that are given to a string_list initializer
STRING_LIST_INIT_{NODUP,DUP} initializers list values only for earlier structure members, relying on the usual convention in C that the omitted members are initailized to 0, i.e. the former is expanded to the latter: struct string_list l = STRING_LIST_INIT_DUP; struct string_list l = { NULL, 0, 0, 1 }; and the last member that is not mentioned (i.e. 'cmp') is initialized to NULL. While there is nothing wrong in this construct, spelling out all the values where the macros are defined will serve also as a documentation, so let's do so. Signed-off-by: Tanay Abhra <tanayabh@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'string-list.h')
-rw-r--r--string-list.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/string-list.h b/string-list.h
index de6769c..dd5e294 100644
--- a/string-list.h
+++ b/string-list.h
@@ -15,8 +15,8 @@ struct string_list {
compare_strings_fn cmp; /* NULL uses strcmp() */
};
-#define STRING_LIST_INIT_NODUP { NULL, 0, 0, 0 }
-#define STRING_LIST_INIT_DUP { NULL, 0, 0, 1 }
+#define STRING_LIST_INIT_NODUP { NULL, 0, 0, 0, NULL }
+#define STRING_LIST_INIT_DUP { NULL, 0, 0, 1, NULL }
void print_string_list(const struct string_list *p, const char *text);
void string_list_clear(struct string_list *list, int free_util);