aboutsummaryrefslogtreecommitdiff
path: root/path-list.h
blob: ca2cbbaa4dccbf3359155e429231f35f55c5f7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef PATH_LIST_H
#define PATH_LIST_H

struct path_list_item {
	char *path;
	void *util;
};
struct path_list
{
	struct path_list_item *items;
	unsigned int nr, alloc;
	unsigned int strdup_paths:1;
};

void print_path_list(const char *text, const struct path_list *p);
void path_list_clear(struct path_list *list, int free_util);

/* Use these functions only on sorted lists: */
int path_list_has_path(const struct path_list *list, const char *path);
struct path_list_item *path_list_insert(const char *path, struct path_list *list);
struct path_list_item *path_list_lookup(const char *path, struct path_list *list);

/* Use these functions only on unsorted lists: */
struct path_list_item *path_list_append(const char *path, struct path_list *list);
void sort_path_list(struct path_list *list);
int unsorted_path_list_has_path(struct path_list *list, const char *path);

#endif /* PATH_LIST_H */