1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 12:59:41 +01:00

string_list_add_refs_by_glob(): add a comment about memory management

Since string_list_add_one_ref() adds refname to the string list, but
the lifetime of refname is limited, it is important that the
string_list passed to string_list_add_one_ref() has strdup_strings
set.  Document this fact.

All current callers do the right thing.

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 2013-05-25 11:08:21 +02:00 committed by Junio C Hamano
parent d235e994f8
commit 8c46bf904f

View file

@ -927,8 +927,12 @@ static int string_list_add_one_ref(const char *refname, const unsigned char *sha
return 0;
}
/*
* The list argument must have strdup_strings set on it.
*/
void string_list_add_refs_by_glob(struct string_list *list, const char *glob)
{
assert(list->strdup_strings);
if (has_glob_specials(glob)) {
for_each_glob_ref(string_list_add_one_ref, glob, list);
} else {