On Mon, Apr 25, 2016 at 10:40 AM, Ralf Thielow <[email protected]> wrote:
> Using the string-list API in function unsorted_string_list_lookup()
> makes the code more readable.
>
> Signed-off-by: Ralf Thielow <[email protected]>
> ---
> Changes since v1:
> - remove extra curly braces

Reviewed-by: Stefan Beller <[email protected]>

>
>  string-list.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/string-list.c b/string-list.c
> index 2a32a3f..62d2084 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;
>  }
>
> --
> 2.8.1.430.g7c694c5
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to