X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fprefix.cc;fp=lib%2Fprefix.cc;h=71a7699189d147b3c43ee5c74c9f73b9da15560d;hb=4743e87c2c79c37208bb60d6617ef203796fc5c2;hp=dd7b193d6ff090639a3eebf1d8a20f8396152f31;hpb=763445beaec906440fbdd497755718ef860b88e4;p=notmuch diff --git a/lib/prefix.cc b/lib/prefix.cc index dd7b193d..71a76991 100644 --- a/lib/prefix.cc +++ b/lib/prefix.cc @@ -166,8 +166,7 @@ _notmuch_database_setup_standard_query_fields (notmuch_database_t *notmuch) notmuch_status_t _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) { - notmuch_config_list_t *list; - notmuch_status_t status; + notmuch_string_map_iterator_t *list; notmuch->user_prefix = _notmuch_string_map_create (notmuch); if (notmuch->user_prefix == NULL) @@ -177,15 +176,16 @@ _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) if (notmuch->user_header == NULL) return NOTMUCH_STATUS_OUT_OF_MEMORY; - status = notmuch_database_get_config_list (notmuch, CONFIG_HEADER_PREFIX, &list); - if (status) - return status; + list = _notmuch_string_map_iterator_create (notmuch->config, CONFIG_HEADER_PREFIX, FALSE); + if (! list) + INTERNAL_ERROR ("unable to read headers from configuration"); - for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next (list)) { + for (; _notmuch_string_map_iterator_valid (list); + _notmuch_string_map_iterator_move_to_next (list)) { prefix_t query_field; - const char *key = notmuch_config_list_key (list) + const char *key = _notmuch_string_map_iterator_key (list) + sizeof (CONFIG_HEADER_PREFIX) - 1; _notmuch_string_map_append (notmuch->user_prefix, @@ -194,7 +194,7 @@ _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) _notmuch_string_map_append (notmuch->user_header, key, - notmuch_config_list_value (list)); + _notmuch_string_map_iterator_value (list)); query_field.name = talloc_strdup (notmuch, key); query_field.prefix = _user_prefix (notmuch, key); @@ -204,7 +204,7 @@ _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) _setup_query_field_default (&query_field, notmuch); } - notmuch_config_list_destroy (list); + _notmuch_string_map_iterator_destroy (list); return NOTMUCH_STATUS_SUCCESS; }