diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-03 14:08:15 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-03 14:08:15 -0700 |
commit | b342567b2e99ece089554d6b0edef835d93b195b (patch) | |
tree | 625c07cf2d0f4ee83eb383957a15b684a05c9f10 /string-list.c | |
parent | Merge branch 'jk/fix-attribute-macro-in-2.5' (diff) | |
parent | string_list: use string-list API in unsorted_string_list_lookup() (diff) | |
download | tgif-b342567b2e99ece089554d6b0edef835d93b195b.tar.xz |
Merge branch 'rt/string-list-lookup-cleanup'
Code cleanup.
* rt/string-list-lookup-cleanup:
string_list: use string-list API in unsorted_string_list_lookup()
Diffstat (limited to 'string-list.c')
-rw-r--r-- | string-list.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/string-list.c b/string-list.c index 2a32a3f1f5..62d20846cb 100644 --- a/string-list.c +++ b/string-list.c @@ -231,12 +231,12 @@ void string_list_sort(struct string_list *list) struct string_list_item *unsorted_string_list_lookup(struct string_list *list, const char *string) { - int i; + struct string_list_item *item; compare_strings_fn cmp = list->cmp ? list->cmp : strcmp; - for (i = 0; i < list->nr; i++) - if (!cmp(string, list->items[i].string)) - return list->items + i; + for_each_string_list_item(item, list) + if (!cmp(string, item->string)) + return item; return NULL; } |