Skip to content

Commit

Permalink
api-string-list.txt: initialize the string_list the easy way
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Sep 12, 2012
1 parent f103f95 commit 51f3145
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Documentation/technical/api-string-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit 51f3145

Please sign in to comment.