mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
string-list: allow case-insensitive string list
Some string list needs to be searched case insensitively, and for that to work correctly, the string needs to be sorted case insensitively from the beginning. Allow a custom comparison function to be defined on a string list instance and use it throughout in place of strcmp(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@@ -5,10 +5,14 @@ struct string_list_item {
|
||||
char *string;
|
||||
void *util;
|
||||
};
|
||||
|
||||
typedef int (*compare_strings_fn)(const char *, const char *);
|
||||
|
||||
struct string_list {
|
||||
struct string_list_item *items;
|
||||
unsigned int nr, alloc;
|
||||
unsigned int strdup_strings:1;
|
||||
compare_strings_fn cmp; /* NULL uses strcmp() */
|
||||
};
|
||||
|
||||
#define STRING_LIST_INIT_NODUP { NULL, 0, 0, 0 }
|
||||
|
||||
Reference in New Issue
Block a user