]> git.ipfire.org Git - thirdparty/git.git/blobdiff - string-list.c
git maintenance: avoid console window in scheduled tasks on Windows
[thirdparty/git.git] / string-list.c
index db473f273e1f77c45f2a5b0cf7a70b106bc19d02..0f8ac117fd584828978568ff96ce21a63a8b160f 100644 (file)
@@ -203,6 +203,15 @@ void string_list_clear_func(struct string_list *list, string_list_clear_func_t c
        list->nr = list->alloc = 0;
 }
 
+void string_list_setlen(struct string_list *list, size_t nr)
+{
+       if (list->strdup_strings)
+               BUG("cannot setlen a string_list which owns its entries");
+       if (nr > list->nr)
+               BUG("cannot grow a string_list with setlen");
+       list->nr = nr;
+}
+
 struct string_list_item *string_list_append_nodup(struct string_list *list,
                                                  char *string)
 {
@@ -301,7 +310,7 @@ int string_list_split(struct string_list *list, const char *string,
 }
 
 int string_list_split_in_place(struct string_list *list, char *string,
-                              int delim, int maxsplit)
+                              const char *delim, int maxsplit)
 {
        int count = 0;
        char *p = string, *end;
@@ -315,7 +324,7 @@ int string_list_split_in_place(struct string_list *list, char *string,
                        string_list_append(list, p);
                        return count;
                }
-               end = strchr(p, delim);
+               end = strpbrk(p, delim);
                if (end) {
                        *end = '\0';
                        string_list_append(list, p);