path: root/string-list.h
diff options
authorJunio C Hamano <>2013-01-07 20:24:55 (GMT)
committerJunio C Hamano <>2013-01-07 23:59:32 (GMT)
commit8dd5afc926acb9829ebf56e9b78826a5242cd638 (patch)
treea2c2056604f0c8b6ed711121b4cdccc16fb68dbc /string-list.h
parent7e0651a6302b50db4bac1e65da61c4036cc64d2a (diff)
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 <>
Diffstat (limited to 'string-list.h')
1 files changed, 4 insertions, 0 deletions
diff --git a/string-list.h b/string-list.h
index c50b0d0..446e79e 100644
--- a/string-list.h
+++ b/string-list.h
@@ -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 }