git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] string_list: use string-list API in unsorted_string_list_lookup()

From
Ralf Thielow <ralf.thielow@gmail.com>
Date
Apr 25, 2016, 17:35 UTC
Message-ID
<87eg9t8uc2.fsf@gmail.com>
In-Reply-To
<alpine.DEB.2.20.1604240901570.2896@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 14 quoted lines
>>  
>> -	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;
>
> If you drop the extra curly braces (thereby matching Git's coding style as
> an additional bonus), at least the patch won't increase the number of
> lines.
>

Oops. I'll send a new version of the patch without these extra curly braces.

Thanks!
> In any case, I like the simplification of the code.
>
> Ciao,
> Dscho
Previous: Johannes SchindelinNext: Ralf Thielow
Message 3 of 6 in “string_list: use string-list API in unsorted_string_list_lookup()”
  1. string_list: use string-list API in unsorted_string_list_lookup()Ralf Thielow, Apr 22, 2016
  2. Johannes SchindelinApr 24, 2016
  3. Ralf ThielowApr 25, 2016
  4. string_list: use string-list API in unsorted_string_list_lookup()Ralf Thielow, Apr 25, 2016
  5. Stefan BellerApr 25, 2016
  6. Johannes SchindelinApr 26, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.