Describe second batch for 1.7.0 in draft release notes
[git/git.git] / string-list.h
CommitLineData
c455c87c
JS
1#ifndef PATH_LIST_H
2#define PATH_LIST_H
3
4struct string_list_item {
5 char *string;
6 void *util;
7};
8struct string_list
9{
10 struct string_list_item *items;
11 unsigned int nr, alloc;
12 unsigned int strdup_strings:1;
13};
14
15void print_string_list(const char *text, const struct string_list *p);
16void string_list_clear(struct string_list *list, int free_util);
17
cfa1ee6b
MSO
18/* Use this function to call a custom clear function on each util pointer */
19/* The string associated with the util pointer is passed as the second argument */
20typedef void (*string_list_clear_func_t)(void *p, const char *str);
21void string_list_clear_func(struct string_list *list, string_list_clear_func_t clearfunc);
22
c6f5a7a9
JS
23/* Use this function to iterate over each item */
24typedef int (*string_list_each_func_t)(struct string_list_item *, void *);
25int for_each_string_list(string_list_each_func_t,
26 struct string_list *list, void *cb_data);
27
c455c87c
JS
28/* Use these functions only on sorted lists: */
29int string_list_has_string(const struct string_list *list, const char *string);
cfa1ee6b
MSO
30int string_list_find_insert_index(const struct string_list *list, const char *string,
31 int negative_existing_index);
c455c87c 32struct string_list_item *string_list_insert(const char *string, struct string_list *list);
cfa1ee6b
MSO
33struct string_list_item *string_list_insert_at_index(int insert_at,
34 const char *string, struct string_list *list);
c455c87c
JS
35struct string_list_item *string_list_lookup(const char *string, struct string_list *list);
36
37/* Use these functions only on unsorted lists: */
38struct string_list_item *string_list_append(const char *string, struct string_list *list);
39void sort_string_list(struct string_list *list);
40int unsorted_string_list_has_string(struct string_list *list, const char *string);
41
42#endif /* PATH_LIST_H */