Although they are not yet needed for the CLI, this will facilitate writing unit tests. --- lib/Makefile.local | 1 - lib/notmuch-private.h | 33 +-------------------------------- util/Makefile.local | 3 ++- {lib => util}/string-map.c | 0 util/string-map.h | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 34 deletions(-) rename {lib => util}/string-map.c (100%) create mode 100644 util/string-map.h diff --git a/lib/Makefile.local b/lib/Makefile.local index 5dc057c0..a9a310b4 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -42,7 +42,6 @@ libnotmuch_c_srcs = \ $(dir)/messages.c \ $(dir)/sha1.c \ $(dir)/built-with.c \ - $(dir)/string-map.c \ $(dir)/indexopts.c \ $(dir)/tags.c diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index 3764a6a9..063df5cd 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -580,38 +580,7 @@ _notmuch_string_list_append (notmuch_string_list_t *list, void _notmuch_string_list_sort (notmuch_string_list_t *list); -/* string-map.c */ -typedef struct _notmuch_string_map notmuch_string_map_t; -typedef struct _notmuch_string_map_iterator notmuch_string_map_iterator_t; -notmuch_string_map_t * -_notmuch_string_map_create (const void *ctx); - -void -_notmuch_string_map_append (notmuch_string_map_t *map, - const char *key, - const char *value); - -const char * -_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, - bool exact); - -bool -_notmuch_string_map_iterator_valid (notmuch_string_map_iterator_t *iter); - -void -_notmuch_string_map_iterator_move_to_next (notmuch_string_map_iterator_t *iter); - -const char * -_notmuch_string_map_iterator_key (notmuch_string_map_iterator_t *iterator); - -const char * -_notmuch_string_map_iterator_value (notmuch_string_map_iterator_t *iterator); - -void -_notmuch_string_map_iterator_destroy (notmuch_string_map_iterator_t *iterator); +#include "string-map.h" /* tags.c */ diff --git a/util/Makefile.local b/util/Makefile.local index ba03230e..71a66158 100644 --- a/util/Makefile.local +++ b/util/Makefile.local @@ -5,7 +5,8 @@ extra_cflags += -I$(srcdir)/$(dir) libnotmuch_util_c_srcs := $(dir)/xutil.c $(dir)/error_util.c $(dir)/hex-escape.c \ $(dir)/string-util.c $(dir)/talloc-extra.c $(dir)/zlib-extra.c \ - $(dir)/util.c $(dir)/gmime-extra.c $(dir)/crypto.c + $(dir)/util.c $(dir)/gmime-extra.c $(dir)/crypto.c \ + $(dir)/string-map.c libnotmuch_util_modules := $(libnotmuch_util_c_srcs:.c=.o) diff --git a/lib/string-map.c b/util/string-map.c similarity index 100% rename from lib/string-map.c rename to util/string-map.c diff --git a/util/string-map.h b/util/string-map.h new file mode 100644 index 00000000..42d16da4 --- /dev/null +++ b/util/string-map.h @@ -0,0 +1,36 @@ +#ifndef STRING_MAP_H +#define STRING_MAP_H + +#include <stdbool.h> +typedef struct _notmuch_string_map notmuch_string_map_t; +typedef struct _notmuch_string_map_iterator notmuch_string_map_iterator_t; +notmuch_string_map_t * +_notmuch_string_map_create (const void *ctx); + +void +_notmuch_string_map_append (notmuch_string_map_t *map, + const char *key, + const char *value); + +const char * +_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, + bool exact); + +bool +_notmuch_string_map_iterator_valid (notmuch_string_map_iterator_t *iter); + +void +_notmuch_string_map_iterator_move_to_next (notmuch_string_map_iterator_t *iter); + +const char * +_notmuch_string_map_iterator_key (notmuch_string_map_iterator_t *iterator); + +const char * +_notmuch_string_map_iterator_value (notmuch_string_map_iterator_t *iterator); + +void +_notmuch_string_map_iterator_destroy (notmuch_string_map_iterator_t *iterator); +#endif -- 2.17.1 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch