api-string-list.txt: initialize the string_list the easy way
authorMichael Haggerty <mhagger@alum.mit.edu>
Wed, 12 Sep 2012 14:04:47 +0000 (16:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Sep 2012 18:43:25 +0000 (11:43 -0700)
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>
Documentation/technical/api-string-list.txt
index 32b35d91811aa775a13f2656966c3a49a5fea730..155ac8cb10d53053eb37bf0ea52d42623d6cb3c9 100644 (file)
@@ -44,10 +44,9 @@ member (you need this if you add things later) and you should set the
 Example:
 
 ----
-struct string_list list;
+struct string_list list = STRING_LIST_INIT_NODUP;
 int i;
 
-memset(&list, 0, sizeof(struct string_list));
 string_list_append(&list, "foo");
 string_list_append(&list, "bar");
 for (i = 0; i < list.nr; i++)