api-string-list.txt: initialize the string_list the easy way
In the demo code blurb, show how to initialize the string_list using STRING_LIST_INIT_NODUP rather than memset(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Sep 12, 2012 at 16:04 UTC
51f3145c2834c8f1d94c5b7cf3790baf74b9f521
1 file changed
+1
-2
Documentation/technical/api-string-list.txt
+1
-2
@@ -44,10 +44,9 @@ member (you need this if you add things later) and you should set the
44
Example:
45
46
----
47
-struct string_list list;
47
+struct string_list list = STRING_LIST_INIT_NODUP;
48
int i;
49
50
-memset(&list, 0, sizeof(struct string_list));
50
string_list_append(&list, "foo");
51
string_list_append(&list, "bar");
52
for (i = 0; i < list.nr; i++)