diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-01-07 12:24:55 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-07 15:59:32 -0800 |
commit | 8dd5afc926acb9829ebf56e9b78826a5242cd638 (patch) | |
tree | a2c2056604f0c8b6ed711121b4cdccc16fb68dbc /string-list.h | |
parent | 7e0651a6302b50db4bac1e65da61c4036cc64d2a (diff) | |
download | git-8dd5afc926acb9829ebf56e9b78826a5242cd638.tar.gz |
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>
Diffstat (limited to 'string-list.h')
-rw-r--r-- | string-list.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/string-list.h b/string-list.h index c50b0d0dea..446e79e425 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 } |