summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2013-05-25 11:08:21 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-06-02 15:28:47 -0700
commit8c46bf904fe95105faaa1823332c91d2802182c2 (patch)
tree6bdaa8f5f35adaa47cc86779d2e6a40d0fb47212
parentstring_list_add_one_ref(): rename first parameter to "refname" (diff)
downloadtgif-8c46bf904fe95105faaa1823332c91d2802182c2.tar.xz
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>
-rw-r--r--notes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/notes.c b/notes.c
index fa7cdf7dd2..b69c0b8257 100644
--- a/notes.c
+++ b/notes.c
@@ -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 {