On Sep 21 2017, Junio C Hamano wrote:
> Now you make me curious. How would that variant be different from
> option C. in Jonathan's message?
Only in the parity of the condition.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8
Andreas Schwab writes:
> On Sep 20 2017, Jonathan Nieder wrote:
>
>> Andreas Schwab wrote:
>>> On Sep 19 2017, Jonathan Nieder wrote:
>>
B. #define for_each_string_list_item(item, list) \
if (list->items) \
for (item = ...; ...; ... )
This breaks a call
On Sep 20 2017, Jonathan Nieder wrote:
> Andreas Schwab wrote:
>> On Sep 19 2017, Jonathan Nieder wrote:
>
>>> B. #define for_each_string_list_item(item, list) \
>>> if (list->items) \
>>> for (item = ...; ...; ... )
>>>
>>>This breaks a caller like
>>> if (foo)
>>>
Andreas Schwab wrote:
> On Sep 19 2017, Jonathan Nieder wrote:
>> B. #define for_each_string_list_item(item, list) \
>> if (list->items) \
>> for (item = ...; ...; ... )
>>
>>This breaks a caller like
>> if (foo)
>> for_each_string_list_item(item, list)
>>
On Sep 19 2017, Jonathan Nieder wrote:
> B. #define for_each_string_list_item(item, list) \
> if (list->items) \
> for (item = ...; ...; ... )
>
>This breaks a caller like
> if (foo)
> for_each_string_list_item(item, list)
> ...
>
On Wednesday 20 September 2017 10:57 AM, Jonathan Nieder wrote:
Guard the loop with a NULL check to make the intent crystal clear to
even the most pedantic compiler. A suitably clever compiler could let
the NULL check only run in the first iteration,
Noted this just now. So, the overhead doesn
On 09/20/2017 07:27 AM, Jonathan Nieder wrote:
> From: Michael Haggerty
>
> If you pass a newly initialized or newly cleared `string_list` to
> `for_each_string_list_item()`, then the latter does
>
> for (
> item = (list)->items; /* NULL */
> item < (list)->items + (l
Jonathan Nieder writes:
> D. Eliminate for_each_string_list_item and let callers just do
>
> unsigned int i;
> for (i = 0; i < list->nr; i++) {
> struct string_list_item *item = list->items[i];
> ...
> }
>
>Having to declare item is unnecessarily
From: Michael Haggerty
If you pass a newly initialized or newly cleared `string_list` to
`for_each_string_list_item()`, then the latter does
for (
item = (list)->items; /* NULL */
item < (list)->items + (list)->nr; /* NULL + 0 */
++item)
Even though this
9 matches
Mail list logo