X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fprefix.cc;h=0d92bdd7ddaecfc75801afd2f6f41bf1fac8621a;hb=cc180507b03d9826c92d48ee91dbd9bb5f15cd56;hp=dd7b193d6ff090639a3eebf1d8a20f8396152f31;hpb=0f37509cc7e92f2c09fcd7d7f3e2b477e4f29401;p=notmuch diff --git a/lib/prefix.cc b/lib/prefix.cc index dd7b193d..0d92bdd7 100644 --- a/lib/prefix.cc +++ b/lib/prefix.cc @@ -133,8 +133,8 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch) Xapian::FieldProcessor *fp; if (STRNCMP_LITERAL (prefix->name, "date") == 0) - fp = (new DateFieldProcessor(NOTMUCH_VALUE_TIMESTAMP))->release (); - else if (STRNCMP_LITERAL(prefix->name, "query") == 0) + fp = (new DateFieldProcessor (NOTMUCH_VALUE_TIMESTAMP))->release (); + else if (STRNCMP_LITERAL (prefix->name, "query") == 0) fp = (new QueryFieldProcessor (*notmuch->query_parser, notmuch))->release (); else if (STRNCMP_LITERAL (prefix->name, "thread") == 0) fp = (new ThreadFieldProcessor (*notmuch->query_parser, notmuch))->release (); @@ -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; }