diff options
author | Ralf Thielow <ralf.thielow@gmail.com> | 2016-04-25 19:40:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-25 11:48:27 -0700 |
commit | d16df0c062e45cbaf42b99963d90c77a0ec9b7df (patch) | |
tree | 64cb746fc8bdc7c6e84d9ed81945f6f16b9055f4 | |
parent | 6a6636270fbaf74609cd3e1bd207dd2c420d640a (diff) | |
download | git-d16df0c062e45cbaf42b99963d90c77a0ec9b7df.tar.gz |
string_list: use string-list API in unsorted_string_list_lookup()rt/string-list-lookup-cleanup
Using the string-list API in function unsorted_string_list_lookup()
makes the code more readable.
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-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; } |