Skip to content

Commit 51f3145

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f103f95 commit 51f3145

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Documentation/technical/api-string-list.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ member (you need this if you add things later) and you should set the
4444
Example:
4545

4646
----
47-
struct string_list list;
47+
struct string_list list = STRING_LIST_INIT_NODUP;
4848
int i;
4949

50-
memset(&list, 0, sizeof(struct string_list));
5150
string_list_append(&list, "foo");
5251
string_list_append(&list, "bar");
5352
for (i = 0; i < list.nr; i++)

0 commit comments

Comments
 (0)