[PATCH v2 6/9] cli: change the data structure for notmuch address deduplication

David Bremner david at tethera.net
Thu Sep 24 16:31:30 PDT 2015


Jani Nikula <jani at nikula.org> writes:

> On Thu, 24 Sep 2015, David Bremner <david at tethera.net> wrote:
>> Jani Nikula <jani at nikula.org> writes:
>>
>>
>>> +    else
>>> +	v = !!m1->name - !!m2->name;
>>
>> Is this really idiomatic? It seems a little difficult to follow to me.
>
> Probably depends on whether you're accustomed to using !! for
> "normalizing" zero and non-zero to 0 and 1, respectively.
>
> The alternative seemed a bit too verbose for my liking:
>
>     if (m1->name && m2->name)
>         v = strcmp (m1->name, m2->name);
>     else if (!m1->name && !m2->name)
>         v = 0;
>     else if (m1->name)
>         v = 1;
>     else
>         v = -1;
>

What about adding the verbose version to string-util.c as
e.g. strcmp_null. Theres apparently similar functions in the linux
kernel, gnome-vfs, subversion...

https://codesearch.debian.net/results/strcmp_null/page_0





More information about the notmuch mailing list