aboutsummaryrefslogtreecommitdiff
path: root/lib/string-map.c
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2018-02-04 15:33:34 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2018-02-04 15:33:34 -0500
commitd9be1028d47cb7e98b474df420858a690798810b (patch)
treefb37f83ca098129a5301ef141dc6a5007a0972a9 /lib/string-map.c
parenta8fb877ad7e960d69ec10887ff79e24bb99c587c (diff)
parent3c4e64d976eb561ac5157df1bbe5882e3e65b583 (diff)
Merge tag 'debian/0.26-1' into debian/stretch-backports
notmuch Debian 0.26-1 upload (same as 0.26)
Diffstat (limited to 'lib/string-map.c')
-rw-r--r--lib/string-map.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/string-map.c b/lib/string-map.c
index 0bb77e93..5aac8bcc 100644
--- a/lib/string-map.c
+++ b/lib/string-map.c
@@ -33,14 +33,14 @@ typedef struct _notmuch_string_pair_t {
} notmuch_string_pair_t;
struct _notmuch_string_map {
- notmuch_bool_t sorted;
+ bool sorted;
size_t length;
notmuch_string_pair_t *pairs;
};
struct _notmuch_string_map_iterator {
notmuch_string_pair_t *current;
- notmuch_bool_t exact;
+ bool exact;
const char *key;
};
@@ -55,7 +55,7 @@ _notmuch_string_map_create (const void *ctx)
map->length = 0;
map->pairs = NULL;
- map->sorted = TRUE;
+ map->sorted = true;
return map;
}
@@ -67,7 +67,7 @@ _notmuch_string_map_append (notmuch_string_map_t *map,
{
map->length++;
- map->sorted = FALSE;
+ map->sorted = false;
if (map->pairs)
map->pairs = talloc_realloc (map, map->pairs, notmuch_string_pair_t, map->length + 1);
@@ -103,11 +103,11 @@ _notmuch_string_map_sort (notmuch_string_map_t *map)
qsort (map->pairs, map->length, sizeof (notmuch_string_pair_t), cmppair);
- map->sorted = TRUE;
+ map->sorted = true;
}
-static notmuch_bool_t
-string_cmp (const char *a, const char *b, notmuch_bool_t exact)
+static bool
+string_cmp (const char *a, const char *b, bool exact)
{
if (exact)
return (strcmp (a, b));
@@ -116,7 +116,7 @@ string_cmp (const char *a, const char *b, notmuch_bool_t exact)
}
static notmuch_string_pair_t *
-bsearch_first (notmuch_string_pair_t *array, size_t len, const char *key, notmuch_bool_t exact)
+bsearch_first (notmuch_string_pair_t *array, size_t len, const char *key, bool exact)
{
size_t first = 0;
size_t last = len - 1;
@@ -151,7 +151,7 @@ _notmuch_string_map_get (notmuch_string_map_t *map, const char *key)
/* this means that calling append invalidates iterators */
_notmuch_string_map_sort (map);
- pair = bsearch_first (map->pairs, map->length, key, TRUE);
+ pair = bsearch_first (map->pairs, map->length, key, true);
if (! pair)
return NULL;
@@ -160,7 +160,7 @@ _notmuch_string_map_get (notmuch_string_map_t *map, const char *key)
notmuch_string_map_iterator_t *
_notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
- notmuch_bool_t exact)
+ bool exact)
{
notmuch_string_map_iterator_t *iter;
@@ -179,15 +179,15 @@ _notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
return iter;
}
-notmuch_bool_t
+bool
_notmuch_string_map_iterator_valid (notmuch_string_map_iterator_t *iterator)
{
if (iterator->current == NULL)
- return FALSE;
+ return false;
/* sentinel */
if (iterator->current->key == NULL)
- return FALSE;
+ return false;
return (0 == string_cmp (iterator->key, iterator->current->key, iterator->exact));