1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 06:47:52 +01:00

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>
This commit is contained in:
Michael Haggerty 2012-09-12 16:04:47 +02:00 committed by Junio C Hamano
parent f103f95b11
commit 51f3145c28

View file

@ -44,10 +44,9 @@ member (you need this if you add things later) and you should set the
Example: Example:
---- ----
struct string_list list; struct string_list list = STRING_LIST_INIT_NODUP;
int i; int i;
memset(&list, 0, sizeof(struct string_list));
string_list_append(&list, "foo"); string_list_append(&list, "foo");
string_list_append(&list, "bar"); string_list_append(&list, "bar");
for (i = 0; i < list.nr; i++) for (i = 0; i < list.nr; i++)