Re: [RFC PATCH 4/5] cli: change the data structure for notmuch address deduplication

2015-08-30 Thread Jani Nikula
On Sun, 30 Aug 2015, David Bremner da...@tethera.net wrote: Jani Nikula j...@nikula.org writes: +static int +strcase_equal (const void *a, const void *b) +{ +return strcasecmp (a, b) == 0; +} + +static unsigned int +strcase_hash (const void *ptr) +{ +const char *s = ptr; +

Re: [RFC PATCH 4/5] cli: change the data structure for notmuch address deduplication

2015-08-30 Thread Jani Nikula
On Sun, 30 Aug 2015, David Bremner da...@tethera.net wrote: I guess this doesn't make the error handling worse; both old and new code silently ignore OOM if I understand correctly. Oh, and current git will not silently ignore OOM. It will segfault... ;) BR, Jani.

Re: [RFC PATCH 4/5] cli: change the data structure for notmuch address deduplication

2015-08-30 Thread David Bremner
Jani Nikula j...@nikula.org writes: I found this use of mailbox as a temporary variable confusing; despite the obvious return I thought it might have something to do with the g_list_append below. Maybe just make a block scope temporary variable? This is how the function would turn out with

[RFC PATCH 4/5] cli: change the data structure for notmuch address deduplication

2015-08-29 Thread Jani Nikula
Currently we key the address hash table with the case sensitive name address. Switch to case insensitive keying with just address, and store the case sensitive name and address in linked lists. This will be helpful in adding support different deduplication schemes in the future. There will be a

Re: [RFC PATCH 4/5] cli: change the data structure for notmuch address deduplication

2015-08-29 Thread David Bremner
Jani Nikula j...@nikula.org writes: +static int +strcase_equal (const void *a, const void *b) +{ +return strcasecmp (a, b) == 0; +} + +static unsigned int +strcase_hash (const void *ptr) +{ +const char *s = ptr; + +/* This is the djb2 hash. */ +unsigned int hash =