diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2008-02-29 01:44:56 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-01 01:51:44 -0800 |
commit | 363d59df1a773039d0c69ad8c3109a56bb1b491d (patch) | |
tree | 3ab55d630a49bbc31ed87e847388bda83268af35 /path-list.h | |
parent | 6d21667206c4c2b10aad99eca1530a4f17c4e61d (diff) | |
download | git-363d59df1a773039d0c69ad8c3109a56bb1b491d.tar.gz git-363d59df1a773039d0c69ad8c3109a56bb1b491d.tar.xz |
path-list: add functions to work with unsorted lists
Up to now, path-lists were sorted at all times. But sometimes it
is much more convenient to build the list and sort it at the end,
or sort it not at all.
Add path_list_append() and sort_path_list() to allow that.
Also, add the unsorted_path_list_has_path() function, to do a linear
search.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path-list.h')
-rw-r--r-- | path-list.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/path-list.h b/path-list.h index 5931e2cc0..ca2cbbaa4 100644 --- a/path-list.h +++ b/path-list.h @@ -13,10 +13,16 @@ struct path_list }; 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); -void path_list_clear(struct path_list *list, int free_util); 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 */ |