[PATCH] lib/string_map: fix return type of string_cmp

David Bremner david at tethera.net
Sat Mar 2 10:34:12 PST 2019

I can't figure out how checking the sign of a bool ever worked. The
following program demonstrates the problem (i.e. for me it prints 1).

 #include <stdio.h>
 #include <stdbool.h>
 int main(int argc, char **argv) {
    bool x;
    x = -1;
    printf("x = %d\n", x);

This seems to be mandated by the C99 standard

 I'd like to get this in a new point release ASAP.

 lib/string-map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/string-map.c b/lib/string-map.c
index ad818207..a88404c7 100644
--- a/lib/string-map.c
+++ b/lib/string-map.c
@@ -106,7 +106,7 @@ _notmuch_string_map_sort (notmuch_string_map_t *map)
     map->sorted = true;
-static bool
+static int
 string_cmp (const char *a, const char *b, bool exact)
     if (exact)

More information about the notmuch mailing list