]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
authorTimo Sirainen <tss@iki.fi>
Fri, 19 Dec 2008 07:06:38 +0000 (09:06 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 19 Dec 2008 07:06:38 +0000 (09:06 +0200)
Based on patch by Apple.

--HG--
branch : HEAD

31 files changed:
src/auth/auth-cache.c
src/auth/auth-request-handler.c
src/auth/db-ldap.c
src/auth/db-passwd-file.c
src/auth/otp-skey-common.c
src/auth/passdb-checkpassword.c
src/auth/passdb-ldap.c
src/auth/userdb-checkpassword.c
src/auth/userdb-ldap.c
src/deliver/duplicate.c
src/lib-auth/auth-server-connection.c
src/lib-auth/auth-server-request.c
src/lib-dict/dict-file.c
src/lib-index/mail-cache-fields.c
src/lib-index/mail-cache.c
src/lib-index/mail-index.c
src/lib-sql/sql-pool.c
src/lib-storage/index/dbox/dbox-sync.c
src/lib-storage/index/index-thread-finish.c
src/lib-storage/index/maildir/maildir-keywords.c
src/lib-storage/index/maildir/maildir-uidlist.c
src/lib/child-wait.c
src/lib/hash.c
src/lib/hash.h
src/login-common/master.c
src/login-common/ssl-proxy-gnutls.c
src/master/auth-process.c
src/master/child-process.c
src/master/login-process.c
src/master/mail-process.c
src/plugins/acl/acl-cache.c

index 3b15edc241318754e5bdac96cdda94a5a6eeda44..9862d7f6d8c9e393a5c8e335a76c408d1f023769 100644 (file)
@@ -86,7 +86,7 @@ auth_cache_node_destroy(struct auth_cache *cache, struct auth_cache_node *node)
        auth_cache_node_unlink(cache, node);
 
        cache->size_left += node->alloc_size;
-       hash_remove(cache->hash, node->data);
+       hash_table_remove(cache->hash, node->data);
        i_free(node);
 }
 
@@ -119,8 +119,8 @@ struct auth_cache *auth_cache_new(size_t max_size, unsigned int ttl_secs,
        struct auth_cache *cache;
 
        cache = i_new(struct auth_cache, 1);
-       cache->hash = hash_create(default_pool, default_pool, 0, str_hash,
-                                 (hash_cmp_callback_t *)strcmp);
+       cache->hash = hash_table_create(default_pool, default_pool, 0, str_hash,
+                                       (hash_cmp_callback_t *)strcmp);
        cache->size_left = max_size;
        cache->ttl_secs = ttl_secs;
        cache->neg_ttl_secs = neg_ttl_secs;
@@ -139,7 +139,7 @@ void auth_cache_free(struct auth_cache **_cache)
        lib_signals_unset_handler(SIGUSR2, sig_auth_cache_stats, cache);
 
        auth_cache_clear(cache);
-       hash_destroy(&cache->hash);
+       hash_table_destroy(&cache->hash);
        i_free(cache);
 }
 
@@ -147,7 +147,7 @@ void auth_cache_clear(struct auth_cache *cache)
 {
        while (cache->tail != NULL)
                auth_cache_node_destroy(cache, cache->tail);
-       hash_clear(cache->hash, FALSE);
+       hash_table_clear(cache->hash, FALSE);
 }
 
 const char *
@@ -169,7 +169,7 @@ auth_cache_lookup(struct auth_cache *cache, const struct auth_request *request,
                   auth_request_get_var_expand_table(request,
                                                     auth_request_str_escape));
 
-       node = hash_lookup(cache->hash, str_c(str));
+       node = hash_table_lookup(cache->hash, str_c(str));
        if (node == NULL) {
                cache->miss_count++;
                return NULL;
@@ -233,7 +233,7 @@ void auth_cache_insert(struct auth_cache *cache, struct auth_request *request,
        while (cache->size_left < alloc_size)
                auth_cache_node_destroy(cache, cache->tail);
 
-       node = hash_lookup(cache->hash, str_c(str));
+       node = hash_table_lookup(cache->hash, str_c(str));
        if (node != NULL) {
                /* key is already in cache (probably expired), remove it */
                auth_cache_node_destroy(cache, node);
@@ -250,7 +250,7 @@ void auth_cache_insert(struct auth_cache *cache, struct auth_request *request,
        auth_cache_node_link_head(cache, node);
 
        cache->size_left -= alloc_size;
-       hash_insert(cache->hash, node->data, node);
+       hash_table_insert(cache->hash, node->data, node);
 }
 
 void auth_cache_remove(struct auth_cache *cache,
@@ -265,7 +265,7 @@ void auth_cache_remove(struct auth_cache *cache,
                   auth_request_get_var_expand_table(request,
                                                     auth_request_str_escape));
 
-       node = hash_lookup(cache->hash, str_c(str));
+       node = hash_table_lookup(cache->hash, str_c(str));
        if (node == NULL)
                return;
 
index 47919fe884bd24e03fe7f7f491050925b13a1930..66cc7c7b864512c44e8e5c69a58b674f5ee16d4d 100644 (file)
@@ -52,7 +52,7 @@ auth_request_handler_create(struct auth *auth,
        handler = p_new(pool, struct auth_request_handler, 1);
        handler->refcount = 1;
        handler->pool = pool;
-       handler->requests = hash_create(default_pool, pool, 0, NULL, NULL);
+       handler->requests = hash_table_create(default_pool, pool, 0, NULL, NULL);
        handler->auth = auth;
        handler->callback = callback;
        handler->context = context;
@@ -71,18 +71,18 @@ void auth_request_handler_unref(struct auth_request_handler **_handler)
        if (--handler->refcount > 0)
                return;
 
-       iter = hash_iterate_init(handler->requests);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(handler->requests);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct auth_request *auth_request = value;
 
                auth_request_unref(&auth_request);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 
        /* notify parent that we're done with all requests */
        handler->callback(NULL, handler->context);
 
-       hash_destroy(&handler->requests);
+       hash_table_destroy(&handler->requests);
        pool_unref(&handler->pool);
 }
 
@@ -97,7 +97,7 @@ void auth_request_handler_set(struct auth_request_handler *handler,
 static void auth_request_handler_remove(struct auth_request_handler *handler,
                                        struct auth_request *request)
 {
-       hash_remove(handler->requests, POINTER_CAST(request->id));
+       hash_table_remove(handler->requests, POINTER_CAST(request->id));
        auth_request_unref(&request);
 }
 
@@ -106,14 +106,14 @@ void auth_request_handler_check_timeouts(struct auth_request_handler *handler)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(handler->requests);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(handler->requests);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct auth_request *request = value;
 
                if (request->last_access + AUTH_REQUEST_TIMEOUT < ioloop_time)
                        auth_request_handler_remove(handler, request);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 }
 
 static void get_client_extra_fields(struct auth_request *request,
@@ -352,7 +352,7 @@ bool auth_request_handler_auth_begin(struct auth_request_handler *handler,
                return FALSE;
        }
 
-       hash_insert(handler->requests, POINTER_CAST(id), request);
+       hash_table_insert(handler->requests, POINTER_CAST(id), request);
 
        if (request->auth->ssl_require_client_cert &&
            !request->valid_client_cert) {
@@ -402,7 +402,7 @@ bool auth_request_handler_auth_continue(struct auth_request_handler *handler,
 
        id = (unsigned int)strtoul(args, NULL, 10);
 
-       request = hash_lookup(handler->requests, POINTER_CAST(id));
+       request = hash_table_lookup(handler->requests, POINTER_CAST(id));
        if (request == NULL) {
                struct auth_stream_reply *reply;
 
@@ -489,7 +489,7 @@ void auth_request_handler_master_request(struct auth_request_handler *handler,
 
        reply = auth_stream_reply_init(pool_datastack_create());
 
-       request = hash_lookup(handler->requests, POINTER_CAST(client_id));
+       request = hash_table_lookup(handler->requests, POINTER_CAST(client_id));
        if (request == NULL) {
                i_error("Master request %u.%u not found",
                        handler->client_pid, client_id);
index ff89bb6e4887b03d4ac1665921640b4a9a0d1602..95e97a0d1412c55526e0b47ce55e4cf5cdf6d587 100644 (file)
@@ -917,13 +917,13 @@ void db_ldap_set_attrs(struct ldap_connection *conn, const char *attrlist,
 
                if (*name != '\0' &&
                    (skip_attr == NULL || strcmp(skip_attr, value) != 0)) {
-                       hash_insert(attr_map, name, value);
+                       hash_table_insert(attr_map, name, value);
                        (*attr_names_r)[j++] = name;
                }
        }
        if (str_len(static_data) > 0) {
-               hash_insert(attr_map, "",
-                           p_strdup(conn->pool, str_c(static_data)));
+               hash_table_insert(attr_map, "",
+                                 p_strdup(conn->pool, str_c(static_data)));
        }
 }
 
@@ -986,7 +986,7 @@ db_ldap_result_iterate_init(struct ldap_connection *conn, LDAPMessage *entry,
        ctx->auth_request = auth_request;
        ctx->attr_map = attr_map;
 
-       static_data = hash_lookup(attr_map, "");
+       static_data = hash_table_lookup(attr_map, "");
        if (static_data != NULL) {
                const struct var_expand_table *table;
                string_t *str;
@@ -1023,7 +1023,7 @@ db_ldap_result_iterate_finish(struct db_ldap_result_iterate_context *ctx)
 static void
 db_ldap_result_change_attr(struct db_ldap_result_iterate_context *ctx)
 {
-       ctx->name = hash_lookup(ctx->attr_map, ctx->attr);
+       ctx->name = hash_table_lookup(ctx->attr_map, ctx->attr);
        ctx->template = NULL;
 
        if (ctx->debug != NULL) {
@@ -1260,9 +1260,9 @@ void db_ldap_unref(struct ldap_connection **_conn)
        aqueue_deinit(&conn->request_queue);
 
        if (conn->pass_attr_map != NULL)
-               hash_destroy(&conn->pass_attr_map);
+               hash_table_destroy(&conn->pass_attr_map);
        if (conn->user_attr_map != NULL)
-               hash_destroy(&conn->user_attr_map);
+               hash_table_destroy(&conn->user_attr_map);
        pool_unref(&conn->pool);
 }
 
index 4877827c0b12e32ead63cb95af5c135b654c0874..5ca6bc69e6c41f8511411c8b96ca086e3320d39b 100644 (file)
@@ -29,7 +29,7 @@ static void passwd_file_add(struct passwd_file *pw, const char *username,
        char *user;
        size_t len;
 
-       if (hash_lookup(pw->users, username) != NULL) {
+       if (hash_table_lookup(pw->users, username) != NULL) {
                i_error("passwd-file %s: User %s exists more than once",
                        pw->path, username);
                return;
@@ -136,7 +136,7 @@ static void passwd_file_add(struct passwd_file *pw, const char *username,
                         p_strsplit_spaces(pw->pool, extra_fields, " ");
         }
 
-       hash_insert(pw->users, user, pu);
+       hash_table_insert(pw->users, user, pu);
 }
 
 static struct passwd_file *
@@ -150,7 +150,7 @@ passwd_file_new(struct db_passwd_file *db, const char *expanded_path)
        pw->fd = -1;
 
        if (db->files != NULL)
-               hash_insert(db->files, pw->path, pw);
+               hash_table_insert(db->files, pw->path, pw);
        return pw;
 }
 
@@ -179,8 +179,8 @@ static bool passwd_file_open(struct passwd_file *pw)
        pw->size = st.st_size;
 
        pw->pool = pool_alloconly_create(MEMPOOL_GROWING"passwd_file", 10240);
-       pw->users = hash_create(default_pool, pw->pool, 100,
-                               str_hash, (hash_cmp_callback_t *)strcmp);
+       pw->users = hash_table_create(default_pool, pw->pool, 100,
+                                     str_hash, (hash_cmp_callback_t *)strcmp);
 
        input = i_stream_create_fd(pw->fd, 4096, FALSE);
        i_stream_set_return_partial_line(input, TRUE);
@@ -203,7 +203,7 @@ static bool passwd_file_open(struct passwd_file *pw)
 
        if (pw->db->debug) {
                i_info("passwd-file %s: Read %u users",
-                      pw->path, hash_count(pw->users));
+                      pw->path, hash_table_count(pw->users));
        }
        return TRUE;
 }
@@ -217,7 +217,7 @@ static void passwd_file_close(struct passwd_file *pw)
        }
 
        if (pw->users != NULL)
-               hash_destroy(&pw->users);
+               hash_table_destroy(&pw->users);
        if (pw->pool != NULL)
                pool_unref(&pw->pool);
 }
@@ -225,7 +225,7 @@ static void passwd_file_close(struct passwd_file *pw)
 static void passwd_file_free(struct passwd_file *pw)
 {
        if (pw->db->files != NULL)
-               hash_remove(pw->db->files, pw->path);
+               hash_table_remove(pw->db->files, pw->path);
 
        passwd_file_close(pw);
        i_free(pw->path);
@@ -309,9 +309,9 @@ db_passwd_file_init(const char *path, const char *username_format,
 
        db->path = i_strdup(path);
        if (db->vars) {
-               db->files = hash_create(default_pool, default_pool, 100,
-                                       str_hash,
-                                       (hash_cmp_callback_t *)strcmp);
+               db->files = hash_table_create(default_pool, default_pool, 100,
+                                             str_hash,
+                                             (hash_cmp_callback_t *)strcmp);
        } else {
                db->default_file = passwd_file_new(db, path);
        }
@@ -352,14 +352,14 @@ void db_passwd_file_unref(struct db_passwd_file **_db)
        if (db->default_file != NULL)
                passwd_file_free(db->default_file);
        else {
-               iter = hash_iterate_init(db->files);
-               while (hash_iterate(iter, &key, &value)) {
+               iter = hash_table_iterate_init(db->files);
+               while (hash_table_iterate(iter, &key, &value)) {
                        struct passwd_file *file = value;
 
                        passwd_file_free(file);
                }
-               hash_iterate_deinit(&iter);
-               hash_destroy(&db->files);
+               hash_table_iterate_deinit(&iter);
+               hash_table_destroy(&db->files);
        }
        i_free(db->path);
        i_free(db);
@@ -396,7 +396,7 @@ db_passwd_file_lookup(struct db_passwd_file *db, struct auth_request *request)
                dest = t_str_new(256);
                var_expand(dest, db->path, table);
 
-               pw = hash_lookup(db->files, str_c(dest));
+               pw = hash_table_lookup(db->files, str_c(dest));
                if (pw == NULL) {
                        /* doesn't exist yet. create lookup for it. */
                        pw = passwd_file_new(db, str_c(dest));
@@ -420,7 +420,7 @@ db_passwd_file_lookup(struct db_passwd_file *db, struct auth_request *request)
                               "lookup: user=%s file=%s",
                               str_c(username), pw->path);
 
-       pu = hash_lookup(pw->users, str_c(username));
+       pu = hash_table_lookup(pw->users, str_c(username));
        if (pu == NULL)
                 auth_request_log_info(request, "passwd-file", "unknown user");
        return pu;
index d0266ea8f41a80d2f27789c9c6c0d5ff208329d6..c1c89049e1cdbed89d660c66b22aae95c4452fb5 100644 (file)
@@ -20,17 +20,17 @@ void otp_lock_init(void)
        if (otp_lock_table != NULL)
                return;
 
-       otp_lock_table = hash_create(system_pool, system_pool,
-                                    128, strcase_hash,
-                                    (hash_cmp_callback_t *)strcasecmp);
+       otp_lock_table = hash_table_create(system_pool, system_pool,
+                                          128, strcase_hash,
+                                          (hash_cmp_callback_t *)strcasecmp);
 }
 
 int otp_try_lock(struct auth_request *auth_request)
 {
-       if (hash_lookup(otp_lock_table, auth_request->user))
+       if (hash_table_lookup(otp_lock_table, auth_request->user))
                return FALSE;
 
-       hash_insert(otp_lock_table, auth_request->user, auth_request);
+       hash_table_insert(otp_lock_table, auth_request->user, auth_request);
 
        return TRUE;
 }
@@ -43,7 +43,7 @@ void otp_unlock(struct auth_request *auth_request)
        if (!request->lock)
                return;
 
-       hash_remove(otp_lock_table, auth_request->user);
+       hash_table_remove(otp_lock_table, auth_request->user);
        request->lock = FALSE;
 }
 
index d3a93e1c7633167de2b918245c6453fb5c93014c..946a54675a400b2a89b6961999703de8ead379f9 100644 (file)
@@ -25,7 +25,7 @@ static void checkpassword_request_finish(struct chkpw_auth_request *request,
        verify_plain_callback_t *callback =
                (verify_plain_callback_t *)request->callback;
 
-       hash_remove(module->clients, POINTER_CAST(request->pid));
+       hash_table_remove(module->clients, POINTER_CAST(request->pid));
 
        if (result == PASSDB_RESULT_OK) {
                if (strchr(str_c(request->input_buf), '\n') != NULL) {
@@ -99,7 +99,7 @@ static void sigchld_handler(const struct child_wait_status *status,
                            struct checkpassword_passdb_module *module)
 {
        struct chkpw_auth_request *request = 
-               hash_lookup(module->clients, POINTER_CAST(status->pid));
+               hash_table_lookup(module->clients, POINTER_CAST(status->pid));
 
        switch (checkpassword_sigchld_handler(status, request)) {
        case SIGCHLD_RESULT_UNKNOWN_CHILD:
@@ -216,7 +216,8 @@ checkpassword_verify_plain(struct auth_request *request, const char *password,
                io_add(fd_out[1], IO_WRITE, checkpassword_child_output,
                       chkpw_auth_request);
 
-       hash_insert(module->clients, POINTER_CAST(pid), chkpw_auth_request);
+       hash_table_insert(module->clients, POINTER_CAST(pid),
+                         chkpw_auth_request);
 
        if (checkpassword_passdb_children != NULL)
                child_wait_add_pid(checkpassword_passdb_children, pid);
@@ -238,7 +239,7 @@ checkpassword_preinit(struct auth_passdb *auth_passdb, const char *args)
                PKG_LIBEXECDIR"/checkpassword-reply";
 
        module->clients =
-               hash_create(default_pool, default_pool, 0, NULL, NULL);
+               hash_table_create(default_pool, default_pool, 0, NULL, NULL);
 
        return &module->module;
 }
@@ -250,13 +251,13 @@ static void checkpassword_deinit(struct passdb_module *_module)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(module->clients);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(module->clients);
+       while (hash_table_iterate(iter, &key, &value)) {
                checkpassword_request_finish(value,
                                             PASSDB_RESULT_INTERNAL_FAILURE);
        }
-       hash_iterate_deinit(&iter);
-       hash_destroy(&module->clients);
+       hash_table_iterate_deinit(&iter);
+       hash_table_destroy(&module->clients);
 
        if (checkpassword_passdb_children != NULL)
                child_wait_free(&checkpassword_passdb_children);
index 92109c464900e08207126313af4653c987f7b822..e980ac15beb1d140c1f88842cec733fc10cccf43 100644 (file)
@@ -380,8 +380,8 @@ passdb_ldap_preinit(struct auth_passdb *auth_passdb, const char *args)
        module = p_new(auth_passdb->auth->pool, struct ldap_passdb_module, 1);
        module->conn = conn = db_ldap_init(args);
        conn->pass_attr_map =
-               hash_create(default_pool, conn->pool, 0, str_hash,
-                           (hash_cmp_callback_t *)strcmp);
+               hash_table_create(default_pool, conn->pool, 0, str_hash,
+                                 (hash_cmp_callback_t *)strcmp);
 
        db_ldap_set_attrs(conn, conn->set.pass_attrs, &conn->pass_attr_names,
                          conn->pass_attr_map,
index c806bd8d262389b478cd0aac77078270a815ca26..5f65213109c990ea0ba7d7ef3d2d603aa5ab5e51 100644 (file)
@@ -25,7 +25,7 @@ static void checkpassword_request_finish(struct chkpw_auth_request *request,
        userdb_callback_t *callback =
                (userdb_callback_t *)request->callback;
 
-       hash_remove(module->clients, POINTER_CAST(request->pid));
+       hash_table_remove(module->clients, POINTER_CAST(request->pid));
 
        if (result == USERDB_RESULT_OK) {
                if (strchr(str_c(request->input_buf), '\n') != NULL) {
@@ -84,7 +84,7 @@ static void sigchld_handler(const struct child_wait_status *status,
                            struct checkpassword_userdb_module *module)
 {
        struct chkpw_auth_request *request = 
-               hash_lookup(module->clients, POINTER_CAST(status->pid));
+               hash_table_lookup(module->clients, POINTER_CAST(status->pid));
 
        switch (checkpassword_sigchld_handler(status, request)) {
        case SIGCHLD_RESULT_UNKNOWN_CHILD:
@@ -206,7 +206,8 @@ checkpassword_lookup(struct auth_request *request, userdb_callback_t *callback)
                io_add(fd_out[1], IO_WRITE, checkpassword_child_output,
                       chkpw_auth_request);
 
-       hash_insert(module->clients, POINTER_CAST(pid), chkpw_auth_request);
+       hash_table_insert(module->clients, POINTER_CAST(pid),
+                         chkpw_auth_request);
 
        if (checkpassword_userdb_children != NULL)
                child_wait_add_pid(checkpassword_userdb_children, pid);
@@ -228,7 +229,7 @@ checkpassword_preinit(struct auth_userdb *auth_userdb, const char *args)
                PKG_LIBEXECDIR"/checkpassword-reply";
 
        module->clients =
-               hash_create(default_pool, default_pool, 0, NULL, NULL);
+               hash_table_create(default_pool, default_pool, 0, NULL, NULL);
 
        return &module->module;
 }
@@ -240,13 +241,13 @@ static void checkpassword_deinit(struct userdb_module *_module)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(module->clients);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(module->clients);
+       while (hash_table_iterate(iter, &key, &value)) {
                checkpassword_request_finish(value,
                                             USERDB_RESULT_INTERNAL_FAILURE);
        }
-       hash_iterate_deinit(&iter);
-       hash_destroy(&module->clients);
+       hash_table_iterate_deinit(&iter);
+       hash_table_destroy(&module->clients);
 
        if (checkpassword_userdb_children != NULL)
                child_wait_free(&checkpassword_userdb_children);
index c6e488d0a3d4edcb5c65e952b5fc03dd27f875d2..7c8d6cab412448e29b3583339a01c3c85fcd0411 100644 (file)
@@ -123,8 +123,8 @@ userdb_ldap_preinit(struct auth_userdb *auth_userdb, const char *args)
        module = p_new(auth_userdb->auth->pool, struct ldap_userdb_module, 1);
        module->conn = conn = db_ldap_init(args);
        conn->user_attr_map =
-               hash_create(default_pool, conn->pool, 0, str_hash,
-                           (hash_cmp_callback_t *)strcmp);
+               hash_table_create(default_pool, conn->pool, 0, str_hash,
+                                 (hash_cmp_callback_t *)strcmp);
 
        db_ldap_set_attrs(conn, conn->set.user_attrs, &conn->user_attr_names,
                          conn->user_attr_map, NULL);
index 846d46d55c7a9ea53db5de566ffa756538b9c7d6..3a46469f8a0f2bd40af88de48be91a7f24568572 100644 (file)
@@ -144,14 +144,15 @@ duplicate_read_records(struct duplicate_file *file, struct istream *input,
                        d->user = p_strndup(file->pool,
                                            data + hdr.id_size, hdr.user_size);
                        d->time = hdr.stamp;
-                       hash_insert(file->hash, d, d);
+                       hash_table_insert(file->hash, d, d);
                } else {
                         change_count++;
                }
                i_stream_skip(input, hdr.id_size + hdr.user_size);
        }
 
-       if (hash_count(file->hash) * COMPRESS_PERCENTAGE / 100 > change_count)
+       if (hash_table_count(file->hash) *
+           COMPRESS_PERCENTAGE / 100 > change_count)
                file->changed = TRUE;
        return 0;
 }
@@ -212,8 +213,8 @@ static struct duplicate_file *duplicate_new(const char *path)
                                         &file->dotlock);
        if (file->new_fd == -1)
                i_error("file_dotlock_create(%s) failed: %m", path);
-       file->hash = hash_create(default_pool, pool, 0,
-                                duplicate_hash, duplicate_cmp);
+       file->hash = hash_table_create(default_pool, pool, 0,
+                                      duplicate_hash, duplicate_cmp);
        (void)duplicate_read(file);
        return file;
 }
@@ -226,7 +227,7 @@ static void duplicate_free(struct duplicate_file **_file)
        if (file->dotlock != NULL)
                file_dotlock_delete(&file->dotlock);
 
-       hash_destroy(&file->hash);
+       hash_table_destroy(&file->hash);
        pool_unref(&file->pool);
 }
 
@@ -241,7 +242,7 @@ int duplicate_check(const void *id, size_t id_size, const char *user)
        d.id_size = id_size;
        d.user = user;
 
-       return hash_lookup(duplicate_file->hash, &d) != NULL;
+       return hash_table_lookup(duplicate_file->hash, &d) != NULL;
 }
 
 void duplicate_mark(const void *id, size_t id_size,
@@ -263,7 +264,7 @@ void duplicate_mark(const void *id, size_t id_size,
        d->time = timestamp;
 
        duplicate_file->changed = TRUE;
-       hash_insert(duplicate_file->hash, d, d);
+       hash_table_insert(duplicate_file->hash, d, d);
 }
 
 void duplicate_flush(void)
@@ -285,8 +286,8 @@ void duplicate_flush(void)
        o_stream_send(output, &hdr, sizeof(hdr));
 
        memset(&rec, 0, sizeof(rec));
-       iter = hash_iterate_init(file->hash);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(file->hash);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct duplicate *d = value;
 
                rec.stamp = d->time;
@@ -297,7 +298,7 @@ void duplicate_flush(void)
                o_stream_send(output, d->id, rec.id_size);
                o_stream_send(output, d->user, rec.user_size);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
        o_stream_unref(&output);
 
        file->changed = FALSE;
index 49c25030aab57f97ae5a8d475b4098b4e26c3be6..b994e45da18e8c5126dd025bd696428c6ebae11b 100644 (file)
@@ -248,7 +248,7 @@ auth_server_connection_new(struct auth_client *client, const char *path)
        conn->input = i_stream_create_fd(fd, AUTH_CLIENT_MAX_LINE_LENGTH,
                                         FALSE);
        conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
-       conn->requests = hash_create(default_pool, pool, 100, NULL, NULL);
+       conn->requests = hash_table_create(default_pool, pool, 100, NULL, NULL);
        conn->auth_mechs_buf = buffer_create_dynamic(default_pool, 256);
 
        conn->to = timeout_add(AUTH_HANDSHAKE_TIMEOUT,
@@ -324,7 +324,7 @@ static void auth_server_connection_unref(struct auth_server_connection *conn)
                return;
        i_assert(conn->refcount == 0);
 
-       hash_destroy(&conn->requests);
+       hash_table_destroy(&conn->requests);
        buffer_free(&conn->auth_mechs_buf);
 
        i_stream_unref(&conn->input);
index 23f1307b9bd3445906e10722ab344c173bc3a74d..d229d6e9b21ee5c549e6a4c77a5bf8b39f7bd4f3 100644 (file)
@@ -62,8 +62,8 @@ auth_server_request_check_retry(struct auth_request *request, const char *data)
                           try it for the next */
                        request->plaintext_data = i_strdup(data);
 
-                       hash_insert(request->next_conn->requests,
-                                   POINTER_CAST(request->id), request);
+                       hash_table_insert(request->next_conn->requests,
+                                         POINTER_CAST(request->id), request);
                        if (auth_server_send_new_request(request->next_conn,
                                                         request, &error) == 0)
                                request->retrying = TRUE;
@@ -171,15 +171,17 @@ bool auth_client_input_ok(struct auth_server_connection *conn, const char *args)
 
        id = (unsigned int)strtoul(list[0], NULL, 10);
 
-       request = hash_lookup(conn->requests, POINTER_CAST(id));
+       request = hash_table_lookup(conn->requests, POINTER_CAST(id));
        if (request == NULL) {
                /* We've already destroyed the request */
                return TRUE;
        }
 
-       hash_remove(request->conn->requests, POINTER_CAST(id));
-       if (request->next_conn != NULL)
-               hash_remove(request->next_conn->requests, POINTER_CAST(id));
+       hash_table_remove(request->conn->requests, POINTER_CAST(id));
+       if (request->next_conn != NULL) {
+               hash_table_remove(request->next_conn->requests,
+                                 POINTER_CAST(id));
+       }
        request->conn = conn;
        request->next_conn = NULL;
 
@@ -212,7 +214,7 @@ bool auth_client_input_cont(struct auth_server_connection *conn,
 
        id = (unsigned int)strtoul(args, NULL, 10);
 
-       request = hash_lookup(conn->requests, POINTER_CAST(id));
+       request = hash_table_lookup(conn->requests, POINTER_CAST(id));
        if (request == NULL) {
                /* We've already destroyed the request */
                return TRUE;
@@ -243,13 +245,13 @@ bool auth_client_input_fail(struct auth_server_connection *conn,
 
        id = (unsigned int)strtoul(list[0], NULL, 10);
 
-       request = hash_lookup(conn->requests, POINTER_CAST(id));
+       request = hash_table_lookup(conn->requests, POINTER_CAST(id));
        if (request == NULL) {
                /* We've already destroyed the request */
                return TRUE;
        }
 
-       hash_remove(conn->requests, POINTER_CAST(request->id));
+       hash_table_remove(conn->requests, POINTER_CAST(request->id));
        if (request->retrying) {
                next = request->next_conn == NULL ? NULL :
                        get_next_plain_server(request->next_conn);
@@ -265,8 +267,8 @@ bool auth_client_input_fail(struct auth_server_connection *conn,
                        }
                        request->conn = conn;
                } else {
-                       hash_insert(next->requests, POINTER_CAST(request->id),
-                                   request);
+                       hash_table_insert(next->requests,
+                                         POINTER_CAST(request->id), request);
                        request->next_conn = next;
 
                        T_BEGIN {
@@ -307,10 +309,10 @@ void auth_server_requests_remove_all(struct auth_server_connection *conn)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(conn->requests);
-       while (hash_iterate(iter, &key, &value))
+       iter = hash_table_iterate_init(conn->requests);
+       while (hash_table_iterate(iter, &key, &value))
                request_hash_remove(conn, value);
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 }
 
 struct auth_request *
@@ -367,8 +369,8 @@ auth_client_request_new(struct auth_client *client, struct auth_connect_id *id,
 
        T_BEGIN {
                if (auth_server_send_new_request(conn, request, error_r) == 0) {
-                       hash_insert(conn->requests, POINTER_CAST(request->id),
-                                   request);
+                       hash_table_insert(conn->requests,
+                                         POINTER_CAST(request->id), request);
                } else {
                        auth_client_request_free(request);
                        request = NULL;
@@ -398,9 +400,9 @@ void auth_client_request_abort(struct auth_request *request)
 {
        void *id = POINTER_CAST(request->id);
 
-       hash_remove(request->conn->requests, id);
+       hash_table_remove(request->conn->requests, id);
        if (request->next_conn != NULL)
-               hash_remove(request->next_conn->requests, id);
+               hash_table_remove(request->next_conn->requests, id);
 
        request->callback(request, -1, NULL, NULL, request->context);
        auth_client_request_free(request);
index 3d1b1c90a47ce8843a17883edf25d835ab0478a9..5c729a3ef1a003a4830fc161164f134f91f37778 100644 (file)
@@ -74,8 +74,8 @@ static struct dict *file_dict_init(struct dict *driver, const char *uri,
        dict->dict = *driver;
        dict->path = i_strdup(uri);
        dict->hash_pool = pool_alloconly_create("file dict", 1024);
-       dict->hash = hash_create(default_pool, dict->hash_pool, 0, str_hash,
-                                (hash_cmp_callback_t *)strcmp);
+       dict->hash = hash_table_create(default_pool, dict->hash_pool, 0,
+                                      str_hash, (hash_cmp_callback_t *)strcmp);
        dict->fd = -1;
        return &dict->dict;
 }
@@ -84,7 +84,7 @@ static void file_dict_deinit(struct dict *_dict)
 {
        struct file_dict *dict = (struct file_dict *)_dict;
 
-       hash_destroy(&dict->hash);
+       hash_table_destroy(&dict->hash);
        pool_unref(&dict->hash_pool);
        i_free(dict->path);
        i_free(dict);
@@ -136,7 +136,7 @@ static int file_dict_refresh(struct file_dict *dict)
                return -1;
        }
 
-       hash_clear(dict->hash, TRUE);
+       hash_table_clear(dict->hash, TRUE);
        p_clear(dict->hash_pool);
 
        input = i_stream_create_fd(dict->fd, (size_t)-1, FALSE);
@@ -144,7 +144,7 @@ static int file_dict_refresh(struct file_dict *dict)
               (value = i_stream_read_next_line(input)) != NULL) {
                key = p_strdup(dict->hash_pool, key);
                value = p_strdup(dict->hash_pool, value);
-               hash_insert(dict->hash, key, value);
+               hash_table_insert(dict->hash, key, value);
        }
        i_stream_destroy(&input);
        return 0;
@@ -158,7 +158,7 @@ static int file_dict_lookup(struct dict *_dict, pool_t pool,
        if (file_dict_refresh(dict) < 0)
                return -1;
 
-       *value_r = p_strdup(pool, hash_lookup(dict->hash, key));
+       *value_r = p_strdup(pool, hash_table_lookup(dict->hash, key));
        return *value_r == NULL ? 0 : 1;
 }
 
@@ -174,7 +174,7 @@ file_dict_iterate_init(struct dict *_dict, const char *path,
        ctx->path = i_strdup(path);
        ctx->path_len = strlen(path);
        ctx->flags = flags;
-       ctx->iter = hash_iterate_init(dict->hash);
+       ctx->iter = hash_table_iterate_init(dict->hash);
 
        if (file_dict_refresh(dict) < 0)
                ctx->failed = TRUE;
@@ -188,7 +188,7 @@ static int file_dict_iterate(struct dict_iterate_context *_ctx,
                (struct file_dict_iterate_context *)_ctx;
        void *key, *value;
 
-       while (hash_iterate(ctx->iter, &key, &value)) {
+       while (hash_table_iterate(ctx->iter, &key, &value)) {
                if (strncmp(ctx->path, key, ctx->path_len) != 0)
                        continue;
 
@@ -208,7 +208,7 @@ static void file_dict_iterate_deinit(struct dict_iterate_context *_ctx)
        struct file_dict_iterate_context *ctx =
                (struct file_dict_iterate_context *)_ctx;
 
-       hash_iterate_deinit(&ctx->iter);
+       hash_table_iterate_deinit(&ctx->iter);
        i_free(ctx->path);
        i_free(ctx);
 }
@@ -239,8 +239,8 @@ static void file_dict_apply_changes(struct file_dict_transaction_context *ctx)
 
        changes = array_get(&ctx->changes, &count);
        for (i = 0; i < count; i++) {
-               if (hash_lookup_full(dict->hash, changes[i].key,
-                                    &orig_key, &orig_value)) {
+               if (hash_table_lookup_full(dict->hash, changes[i].key,
+                                          &orig_key, &orig_value)) {
                        key = orig_key;
                        old_value = orig_value;
                } else {
@@ -270,11 +270,11 @@ static void file_dict_apply_changes(struct file_dict_transaction_context *ctx)
                                value = p_strdup(dict->hash_pool,
                                                 changes[i].value.str);
                        }
-                       hash_update(dict->hash, key, value);
+                       hash_table_update(dict->hash, key, value);
                        break;
                case FILE_DICT_CHANGE_TYPE_UNSET:
                        if (old_value != NULL)
-                               hash_remove(dict->hash, key);
+                               hash_table_remove(dict->hash, key);
                        break;
                }
        }
@@ -304,14 +304,14 @@ static int file_dict_write_changes(struct file_dict_transaction_context *ctx)
 
        output = o_stream_create_fd(fd, 0, FALSE);
        o_stream_cork(output);
-       iter = hash_iterate_init(dict->hash);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(dict->hash);
+       while (hash_table_iterate(iter, &key, &value)) {
                o_stream_send_str(output, key);
                o_stream_send(output, "\n", 1);
                o_stream_send_str(output, value);
                o_stream_send(output, "\n", 1);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
        o_stream_destroy(&output);
 
        if (file_dotlock_replace(&dotlock,
index 7dd264b1c557f5e43dfc0da09a68ed90fe8444b1..0d274157883391efd2de013d477be9edc74690e2 100644 (file)
@@ -76,8 +76,9 @@ void mail_cache_register_fields(struct mail_cache *cache,
 
        new_idx = cache->fields_count;
        for (i = 0; i < fields_count; i++) {
-               if (hash_lookup_full(cache->field_name_hash, fields[i].name,
-                                    &orig_key, &orig_value)) {
+               if (hash_table_lookup_full(cache->field_name_hash,
+                                          fields[i].name,
+                                          &orig_key, &orig_value)) {
                        i_assert(fields[i].type < MAIL_CACHE_FIELD_COUNT);
 
                        fields[i].idx =
@@ -128,7 +129,8 @@ void mail_cache_register_fields(struct mail_cache *cache,
                if (!field_has_fixed_size(cache->fields[idx].field.type))
                        cache->fields[idx].field.field_size = (unsigned int)-1;
 
-               hash_insert(cache->field_name_hash, name, POINTER_CAST(idx));
+               hash_table_insert(cache->field_name_hash,
+                                 name, POINTER_CAST(idx));
        }
        cache->fields_count = new_idx;
 }
@@ -138,8 +140,8 @@ mail_cache_register_lookup(struct mail_cache *cache, const char *name)
 {
        void *orig_key, *orig_value;
 
-       if (hash_lookup_full(cache->field_name_hash, name,
-                            &orig_key, &orig_value))
+       if (hash_table_lookup_full(cache->field_name_hash, name,
+                                  &orig_key, &orig_value))
                return POINTER_CAST_TO(orig_value, unsigned int);
        else
                return (unsigned int)-1;
@@ -341,8 +343,8 @@ int mail_cache_header_fields_read(struct mail_cache *cache)
                        return -1;
                }
 
-               if (hash_lookup_full(cache->field_name_hash, names,
-                                    &orig_key, &orig_value)) {
+               if (hash_table_lookup_full(cache->field_name_hash, names,
+                                          &orig_key, &orig_value)) {
                        /* already exists, see if decision can be updated */
                        fidx = POINTER_CAST_TO(orig_value, unsigned int);
                        if (!cache->fields[fidx].decision_dirty) {
index 24663fbe38b6e482ae386d3b3b53eeb4116ef41d..39d7a61866cf637cb895c8fc0c3775f64db9e1ce 100644 (file)
@@ -409,8 +409,8 @@ static struct mail_cache *mail_cache_alloc(struct mail_index *index)
                i_strconcat(index->filepath, MAIL_CACHE_FILE_SUFFIX, NULL);
        cache->field_pool = pool_alloconly_create("Cache fields", 1024);
        cache->field_name_hash =
-               hash_create(default_pool, cache->field_pool, 0,
-                           strcase_hash, (hash_cmp_callback_t *)strcasecmp);
+               hash_table_create(default_pool, cache->field_pool, 0,
+                                 strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 
        cache->dotlock_settings.use_excl_lock = index->use_excl_dotlocks;
        cache->dotlock_settings.nfs_flush = index->nfs_flush;
@@ -478,7 +478,7 @@ void mail_cache_free(struct mail_cache **_cache)
 
        mail_cache_file_close(cache);
 
-       hash_destroy(&cache->field_name_hash);
+       hash_table_destroy(&cache->field_name_hash);
        pool_unref(&cache->field_pool);
        i_free(cache->field_file_map);
        i_free(cache->file_field_map);
index a45e6cc5a9d2c51ef0f22c77cd2c7709ce030f5f..8d3569a87d979c520131b5ef56a4a72c3a3fee56 100644 (file)
@@ -49,8 +49,8 @@ struct mail_index *mail_index_alloc(const char *dir, const char *prefix)
        index->keywords_pool = pool_alloconly_create("keywords", 512);
        i_array_init(&index->keywords, 16);
        index->keywords_hash =
-               hash_create(default_pool, index->keywords_pool, 0,
-                           strcase_hash, (hash_cmp_callback_t *)strcasecmp);
+               hash_table_create(default_pool, index->keywords_pool, 0,
+                                 strcase_hash, (hash_cmp_callback_t *)strcasecmp);
        index->log = mail_transaction_log_alloc(index);
        mail_index_modseq_init(index);
        return index;
@@ -64,7 +64,7 @@ void mail_index_free(struct mail_index **_index)
        mail_index_close(index);
 
        mail_transaction_log_free(&index->log);
-       hash_destroy(&index->keywords_hash);
+       hash_table_destroy(&index->keywords_hash);
        pool_unref(&index->extension_pool);
        pool_unref(&index->keywords_pool);
 
@@ -219,7 +219,8 @@ bool mail_index_keyword_lookup(struct mail_index *index,
        /* keywords_hash keeps a name => index mapping of keywords.
           Keywords are never removed from it, so the index values are valid
           for the lifetime of the mail_index. */
-       if (hash_lookup_full(index->keywords_hash, keyword, NULL, &value)) {
+       if (hash_table_lookup_full(index->keywords_hash, keyword,
+                                  NULL, &value)) {
                *idx_r = POINTER_CAST_TO(value, unsigned int);
                return TRUE;
        }
@@ -242,7 +243,8 @@ void mail_index_keyword_lookup_or_create(struct mail_index *index,
        keyword = keyword_dup = p_strdup(index->keywords_pool, keyword);
        *idx_r = array_count(&index->keywords);
 
-       hash_insert(index->keywords_hash, keyword_dup, POINTER_CAST(*idx_r));
+       hash_table_insert(index->keywords_hash,
+                         keyword_dup, POINTER_CAST(*idx_r));
        array_append(&index->keywords, &keyword, 1);
 }
 
index 19905001e6a38416c39f21b126e13afdcf138ae8..f5a0a64723cde0e40ed4622bd479d7e791b68c1e 100644 (file)
@@ -90,7 +90,7 @@ struct sql_db *sql_pool_new(struct sql_pool *pool,
        char *key;
 
        key = i_strdup_printf("%s\t%s", db_driver, connect_string);
-       db = hash_lookup(pool->dbs, key);
+       db = hash_table_lookup(pool->dbs, key);
        if (db != NULL) {
                ctx = SQL_POOL_CONTEXT(db);
                if (ctx->refcount == 0) {
@@ -110,7 +110,7 @@ struct sql_db *sql_pool_new(struct sql_pool *pool,
                db->v.deinit = sql_pool_db_deinit;
 
                MODULE_CONTEXT_SET(db, sql_pool_module, ctx);
-               hash_insert(pool->dbs, ctx->key, db);
+               hash_table_insert(pool->dbs, ctx->key, db);
        }
 
        ctx->refcount++;
@@ -122,8 +122,8 @@ struct sql_pool *sql_pool_init(unsigned int max_unused_connections)
        struct sql_pool *pool;
 
        pool = i_new(struct sql_pool, 1);
-       pool->dbs = hash_create(default_pool, default_pool, 0, str_hash,
-                               (hash_cmp_callback_t *)strcmp);
+       pool->dbs = hash_table_create(default_pool, default_pool, 0, str_hash,
+                                     (hash_cmp_callback_t *)strcmp);
        pool->max_unused_connections = max_unused_connections;
        return pool;
 }
@@ -133,6 +133,6 @@ void sql_pool_deinit(struct sql_pool **_pool)
        struct sql_pool *pool = *_pool;
 
        *_pool = NULL;
-       hash_destroy(&pool->dbs);
+       hash_table_destroy(&pool->dbs);
        i_free(pool);
 }
index bcde8f8893f33b58e4b64681ec14fae104871e02..06f53a9d2e4e8df61271025dee0f971676c2a3bb 100644 (file)
@@ -29,7 +29,7 @@ static int dbox_sync_add_seq(struct dbox_sync_context *ctx,
                              &file_id, &offset))
                return -1;
 
-       entry = hash_lookup(ctx->syncs, POINTER_CAST(file_id));
+       entry = hash_table_lookup(ctx->syncs, POINTER_CAST(file_id));
        if (entry == NULL) {
                if (sync_rec->type == MAIL_INDEX_SYNC_TYPE_EXPUNGE ||
                    ctx->flush_dirty_flags) {
@@ -54,7 +54,7 @@ static int dbox_sync_add_seq(struct dbox_sync_context *ctx,
 
                entry = p_new(ctx->pool, struct dbox_sync_file_entry, 1);
                entry->file_id = file_id;
-               hash_insert(ctx->syncs, POINTER_CAST(file_id), entry);
+               hash_table_insert(ctx->syncs, POINTER_CAST(file_id), entry);
        }
        uid_file = (file_id & DBOX_FILE_ID_FLAG_UID) != 0;
 
@@ -205,7 +205,7 @@ static int dbox_sync_index(struct dbox_sync_context *ctx)
 
        /* read all changes and sort them to file_id order */
        ctx->pool = pool_alloconly_create("dbox sync pool", 1024*32);
-       ctx->syncs = hash_create(default_pool, ctx->pool, 0, NULL, NULL);
+       ctx->syncs = hash_table_create(default_pool, ctx->pool, 0, NULL, NULL);
        i_array_init(&ctx->expunge_files, 32);
        i_array_init(&ctx->locked_files, 32);
 
@@ -225,14 +225,14 @@ static int dbox_sync_index(struct dbox_sync_context *ctx)
 
        if (ret > 0) {
                /* now sync each file separately */
-               iter = hash_iterate_init(ctx->syncs);
-               while (hash_iterate(iter, &key, &value)) {
+               iter = hash_table_iterate_init(ctx->syncs);
+               while (hash_table_iterate(iter, &key, &value)) {
                        const struct dbox_sync_file_entry *entry = value;
 
                        if ((ret = dbox_sync_file(ctx, entry)) <= 0)
                                break;
                }
-               hash_iterate_deinit(&iter);
+               hash_table_iterate_deinit(&iter);
        }
 
        if (ret > 0)
@@ -243,7 +243,7 @@ static int dbox_sync_index(struct dbox_sync_context *ctx)
 
        dbox_sync_unlock_files(ctx);
        array_free(&ctx->locked_files);
-       hash_destroy(&ctx->syncs);
+       hash_table_destroy(&ctx->syncs);
        pool_unref(&ctx->pool);
        return ret;
 }
index 03b1ad74f2decde093e4927774a30f9a2ae02636..8ac222c6b5dd7e8fc82f450b0e166c0de63d5ec3 100644 (file)
@@ -79,12 +79,12 @@ add_base_subject(struct subject_gather_context *ctx, const char *subject,
 
        /* (iii) Look up the message associated with the thread
           subject in the subject table. */
-       if (!hash_lookup_full(ctx->subject_hash, subject, &key, &value)) {
+       if (!hash_table_lookup_full(ctx->subject_hash, subject, &key, &value)) {
                /* (iv) If there is no message in the subject table with the
                   thread subject, add the current message and the thread
                   subject to the subject table. */
                hash_subject = p_strdup(ctx->subject_pool, subject);
-               hash_insert(ctx->subject_hash, hash_subject, node);
+               hash_table_insert(ctx->subject_hash, hash_subject, node);
        } else {
                hash_subject = key;
                hash_node = value;
@@ -103,7 +103,7 @@ add_base_subject(struct subject_gather_context *ctx, const char *subject,
                    (node->dummy ||
                     (hash_node->reply_or_forward && !is_reply_or_forward))) {
                        hash_node->parent_root_idx1 = node->root_idx1;
-                       hash_update(ctx->subject_hash, hash_subject, node);
+                       hash_table_update(ctx->subject_hash, hash_subject, node);
                } else {
                        node->parent_root_idx1 = hash_node->root_idx1;
                }
@@ -219,8 +219,9 @@ static void gather_base_subjects(struct thread_finish_context *ctx)
                pool_alloconly_create(MEMPOOL_GROWING"base subjects",
                                      nearest_power(count * 20));
        gather_ctx.subject_hash =
-               hash_create(default_pool, gather_ctx.subject_pool, count * 2,
-                           str_hash, (hash_cmp_callback_t *)strcmp);
+               hash_table_create(default_pool, gather_ctx.subject_pool,
+                                 count * 2, str_hash,
+                                 (hash_cmp_callback_t *)strcmp);
 
        i_array_init(&sorted_children, 64);
        for (i = 0; i < count; i++) {
@@ -251,7 +252,7 @@ static void gather_base_subjects(struct thread_finish_context *ctx)
        }
        i_assert(roots[count-1].parent_root_idx1 <= count);
        array_free(&sorted_children);
-       hash_destroy(&gather_ctx.subject_hash);
+       hash_table_destroy(&gather_ctx.subject_hash);
        pool_unref(&gather_ctx.subject_pool);
 }
 
index cdfce785417b6db9c35ea4967cdea05b972571bc..4cbd7425e59de57a2b55690f5567b52b91ab44d2 100644 (file)
@@ -71,8 +71,8 @@ maildir_keywords_init_readonly(struct mailbox *box)
        mk->path = i_strconcat(dir, "/" MAILDIR_KEYWORDS_NAME, NULL);
        mk->pool = pool_alloconly_create("maildir keywords", 512);
        i_array_init(&mk->list, MAILDIR_MAX_KEYWORDS);
-       mk->hash = hash_create(default_pool, mk->pool, 0,
-                              strcase_hash, (hash_cmp_callback_t *)strcasecmp);
+       mk->hash = hash_table_create(default_pool, mk->pool, 0,
+                                    strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 
        mk->dotlock_settings.use_excl_lock =
                (box->storage->flags & MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL) != 0;
@@ -91,7 +91,7 @@ void maildir_keywords_deinit(struct maildir_keywords **_mk)
        struct maildir_keywords *mk = *_mk;
 
        *_mk = NULL;
-       hash_destroy(&mk->hash);
+       hash_table_destroy(&mk->hash);
        array_free(&mk->list);
        pool_unref(&mk->pool);
        i_free(mk->path);
@@ -101,7 +101,7 @@ void maildir_keywords_deinit(struct maildir_keywords **_mk)
 static void maildir_keywords_clear(struct maildir_keywords *mk)
 {
        array_clear(&mk->list);
-       hash_clear(mk->hash, FALSE);
+       hash_table_clear(mk->hash, FALSE);
        p_clear(mk->pool);
 }
 
@@ -172,7 +172,7 @@ static int maildir_keywords_sync(struct maildir_keywords *mk)
 
                /* save it */
                new_name = p_strdup(mk->pool, p);
-               hash_insert(mk->hash, new_name, POINTER_CAST(idx + 1));
+               hash_table_insert(mk->hash, new_name, POINTER_CAST(idx + 1));
 
                strp = array_idx_modifiable(&mk->list, idx);
                *strp = new_name;
@@ -194,7 +194,7 @@ maildir_keywords_lookup(struct maildir_keywords *mk, const char *name)
 {
        void *p;
 
-       p = hash_lookup(mk->hash, name);
+       p = hash_table_lookup(mk->hash, name);
        if (p == NULL) {
                if (mk->synced)
                        return -1;
@@ -202,7 +202,7 @@ maildir_keywords_lookup(struct maildir_keywords *mk, const char *name)
                if (maildir_keywords_sync(mk) < 0)
                        return -1;
 
-               p = hash_lookup(mk->hash, name);
+               p = hash_table_lookup(mk->hash, name);
                if (p == NULL)
                        return -1;
        }
@@ -220,7 +220,7 @@ maildir_keywords_create(struct maildir_keywords *mk, const char *name,
        i_assert(chridx < MAILDIR_MAX_KEYWORDS);
 
        new_name = p_strdup(mk->pool, name);
-       hash_insert(mk->hash, new_name, POINTER_CAST(chridx + 1));
+       hash_table_insert(mk->hash, new_name, POINTER_CAST(chridx + 1));
 
        strp = array_idx_modifiable(&mk->list, chridx);
        *strp = new_name;
index d59072a7959fe23b307dd0946120d211bbe46ec8..39839de5954acfcddd8086a1610a6a553764189e 100644 (file)
@@ -228,9 +228,9 @@ maildir_uidlist_init_readonly(struct index_mailbox *ibox)
        uidlist->ibox = ibox;
        uidlist->path = i_strconcat(control_dir, "/"MAILDIR_UIDLIST_NAME, NULL);
        i_array_init(&uidlist->records, 128);
-       uidlist->files = hash_create(default_pool, default_pool, 4096,
-                                    maildir_filename_base_hash,
-                                    maildir_filename_base_cmp);
+       uidlist->files = hash_table_create(default_pool, default_pool, 4096,
+                                          maildir_filename_base_hash,
+                                          maildir_filename_base_cmp);
        uidlist->next_uid = 1;
        uidlist->hdr_extensions = str_new(default_pool, 128);
 
@@ -284,7 +284,7 @@ void maildir_uidlist_deinit(struct maildir_uidlist **_uidlist)
        maildir_uidlist_update(uidlist);
        maildir_uidlist_close(uidlist);
 
-       hash_destroy(&uidlist->files);
+       hash_table_destroy(&uidlist->files);
        if (uidlist->record_pool != NULL)
                pool_unref(&uidlist->record_pool);
 
@@ -467,7 +467,7 @@ static bool maildir_uidlist_next(struct maildir_uidlist *uidlist,
                return FALSE;
        }
 
-       old_rec = hash_lookup(uidlist->files, line);
+       old_rec = hash_table_lookup(uidlist->files, line);
        if (old_rec != NULL) {
                /* This can happen if expunged file is moved back and the file
                   was appended to uidlist. */
@@ -484,7 +484,7 @@ static bool maildir_uidlist_next(struct maildir_uidlist *uidlist,
        }
 
        rec->filename = p_strdup(uidlist->record_pool, line);
-       hash_insert(uidlist->files, rec->filename, rec);
+       hash_table_insert(uidlist->files, rec->filename, rec);
        array_append(&uidlist->records, &rec, 1);
        return TRUE;
 }
@@ -1353,9 +1353,9 @@ int maildir_uidlist_sync_init(struct maildir_uidlist *uidlist,
 
        ctx->record_pool = pool_alloconly_create(MEMPOOL_GROWING
                                                 "maildir_uidlist_sync", 16384);
-       ctx->files = hash_create(default_pool, ctx->record_pool, 4096,
-                                maildir_filename_base_hash,
-                                maildir_filename_base_cmp);
+       ctx->files = hash_table_create(default_pool, ctx->record_pool, 4096,
+                                      maildir_filename_base_hash,
+                                      maildir_filename_base_cmp);
 
        i_array_init(&ctx->records, array_count(&uidlist->records));
        return 1;
@@ -1370,7 +1370,7 @@ maildir_uidlist_sync_next_partial(struct maildir_uidlist_sync_ctx *ctx,
        struct maildir_uidlist_rec *rec;
 
        /* we'll update uidlist directly */
-       rec = hash_lookup(uidlist->files, filename);
+       rec = hash_table_lookup(uidlist->files, filename);
        if (rec == NULL) {
                /* doesn't exist in uidlist */
                if (!ctx->locked) {
@@ -1398,7 +1398,7 @@ maildir_uidlist_sync_next_partial(struct maildir_uidlist_sync_ctx *ctx,
 
        rec->flags = (rec->flags | flags) & ~MAILDIR_UIDLIST_REC_FLAG_NONSYNCED;
        rec->filename = p_strdup(uidlist->record_pool, filename);
-       hash_insert(uidlist->files, rec->filename, rec);
+       hash_table_insert(uidlist->files, rec->filename, rec);
 
        ctx->finished = FALSE;
 }
@@ -1446,7 +1446,7 @@ int maildir_uidlist_sync_next(struct maildir_uidlist_sync_ctx *ctx,
                return 1;
        }
 
-       rec = hash_lookup(ctx->files, filename);
+       rec = hash_table_lookup(ctx->files, filename);
        if (rec != NULL) {
                if ((rec->flags & (MAILDIR_UIDLIST_REC_FLAG_NEW_DIR |
                                   MAILDIR_UIDLIST_REC_FLAG_MOVED)) == 0) {
@@ -1460,7 +1460,7 @@ int maildir_uidlist_sync_next(struct maildir_uidlist_sync_ctx *ctx,
                rec->flags &= ~(MAILDIR_UIDLIST_REC_FLAG_NEW_DIR |
                                MAILDIR_UIDLIST_REC_FLAG_MOVED);
        } else {
-               old_rec = hash_lookup(uidlist->files, filename);
+               old_rec = hash_table_lookup(uidlist->files, filename);
                i_assert(old_rec != NULL || UIDLIST_IS_LOCKED(uidlist));
 
                rec = p_new(ctx->record_pool, struct maildir_uidlist_rec, 1);
@@ -1482,7 +1482,7 @@ int maildir_uidlist_sync_next(struct maildir_uidlist_sync_ctx *ctx,
 
        rec->flags = (rec->flags | flags) & ~MAILDIR_UIDLIST_REC_FLAG_NONSYNCED;
        rec->filename = p_strdup(ctx->record_pool, filename);
-       hash_insert(ctx->files, rec->filename, rec);
+       hash_table_insert(ctx->files, rec->filename, rec);
        return 1;
 }
 
@@ -1494,11 +1494,11 @@ void maildir_uidlist_sync_remove(struct maildir_uidlist_sync_ctx *ctx,
 
        i_assert(ctx->partial);
 
-       rec = hash_lookup(ctx->uidlist->files, filename);
+       rec = hash_table_lookup(ctx->uidlist->files, filename);
        i_assert(rec != NULL);
        i_assert(rec->uid != (uint32_t)-1);
 
-       hash_remove(ctx->uidlist->files, filename);
+       hash_table_remove(ctx->uidlist->files, filename);
        idx = maildir_uidlist_records_array_delete(ctx->uidlist, rec);
 
        if (ctx->first_unwritten_pos != (unsigned int)-1) {
@@ -1520,7 +1520,7 @@ maildir_uidlist_sync_get_full_filename(struct maildir_uidlist_sync_ctx *ctx,
 {
        struct maildir_uidlist_rec *rec;
 
-       rec = hash_lookup(ctx->files, filename);
+       rec = hash_table_lookup(ctx->files, filename);
        return rec == NULL ? NULL : rec->filename;
 }
 
@@ -1529,7 +1529,7 @@ bool maildir_uidlist_get_uid(struct maildir_uidlist *uidlist,
 {
        struct maildir_uidlist_rec *rec;
 
-       rec = hash_lookup(uidlist->files, filename);
+       rec = hash_table_lookup(uidlist->files, filename);
        if (rec == NULL)
                return FALSE;
 
@@ -1543,7 +1543,7 @@ maildir_uidlist_get_full_filename(struct maildir_uidlist *uidlist,
 {
        struct maildir_uidlist_rec *rec;
 
-       rec = hash_lookup(uidlist->files, filename);
+       rec = hash_table_lookup(uidlist->files, filename);
        return rec == NULL ? NULL : rec->filename;
 }
 
@@ -1598,7 +1598,7 @@ static void maildir_uidlist_swap(struct maildir_uidlist_sync_ctx *ctx)
        uidlist->records = ctx->records;
        ctx->records.arr.buffer = NULL;
 
-       hash_destroy(&uidlist->files);
+       hash_table_destroy(&uidlist->files);
        uidlist->files = ctx->files;
        ctx->files = NULL;
 
@@ -1652,7 +1652,7 @@ int maildir_uidlist_sync_deinit(struct maildir_uidlist_sync_ctx **_ctx)
                maildir_uidlist_unlock(ctx->uidlist);
 
        if (ctx->files != NULL)
-               hash_destroy(&ctx->files);
+               hash_table_destroy(&ctx->files);
        if (ctx->record_pool != NULL)
                pool_unref(&ctx->record_pool);
        if (array_is_created(&ctx->records))
@@ -1667,7 +1667,7 @@ void maildir_uidlist_add_flags(struct maildir_uidlist *uidlist,
 {
        struct maildir_uidlist_rec *rec;
 
-       rec = hash_lookup(uidlist->files, filename);
+       rec = hash_table_lookup(uidlist->files, filename);
        i_assert(rec != NULL);
 
        rec->flags |= flags;
index 97fab18173670c6993fdb6a34f057b47bd943d3a..6d33f5db601d0a0bdc994a0e7d1261523e48b183 100644 (file)
@@ -42,15 +42,15 @@ void child_wait_free(struct child_wait **_wait)
 
        if (wait->pid_count > 0) {
                /* this should be rare, so iterating hash is fast enough */
-               iter = hash_iterate_init(child_pids);
-               while (hash_iterate(iter, &key, &value)) {
+               iter = hash_table_iterate_init(child_pids);
+               while (hash_table_iterate(iter, &key, &value)) {
                        if (value == wait) {
-                               hash_remove(child_pids, key);
+                               hash_table_remove(child_pids, key);
                                if (--wait->pid_count == 0)
                                        break;
                        }
                }
-               hash_iterate_deinit(&iter);
+               hash_table_iterate_deinit(&iter);
        }
 
        i_free(wait);
@@ -59,13 +59,13 @@ void child_wait_free(struct child_wait **_wait)
 void child_wait_add_pid(struct child_wait *wait, pid_t pid)
 {
        wait->pid_count++;
-       hash_insert(child_pids, POINTER_CAST(pid), wait);
+       hash_table_insert(child_pids, POINTER_CAST(pid), wait);
 }
 
 void child_wait_remove_pid(struct child_wait *wait, pid_t pid)
 {
        wait->pid_count--;
-       hash_remove(child_pids, POINTER_CAST(pid));
+       hash_table_remove(child_pids, POINTER_CAST(pid));
 }
 
 static void
@@ -74,7 +74,8 @@ sigchld_handler(int signo ATTR_UNUSED, void *context ATTR_UNUSED)
        struct child_wait_status status;
 
        while ((status.pid = waitpid(-1, &status.status, WNOHANG)) > 0) {
-               status.wait = hash_lookup(child_pids, POINTER_CAST(status.pid));
+               status.wait = hash_table_lookup(child_pids,
+                                               POINTER_CAST(status.pid));
                if (status.wait != NULL) {
                        child_wait_remove_pid(status.wait, status.pid);
                        status.wait->callback(&status, status.wait->context);
@@ -87,7 +88,8 @@ sigchld_handler(int signo ATTR_UNUSED, void *context ATTR_UNUSED)
 
 void child_wait_init(void)
 {
-       child_pids = hash_create(default_pool, default_pool, 0, NULL, NULL);
+       child_pids = hash_table_create(default_pool, default_pool, 0,
+                                      NULL, NULL);
 
        lib_signals_set_handler(SIGCHLD, TRUE, sigchld_handler, NULL);
 }
@@ -99,10 +101,10 @@ void child_wait_deinit(void)
 
        lib_signals_unset_handler(SIGCHLD, sigchld_handler, NULL);
 
-       iter = hash_iterate_init(child_pids);
-       while (hash_iterate(iter, &key, &value))
+       iter = hash_table_iterate_init(child_pids);
+       while (hash_table_iterate(iter, &key, &value))
                i_free(value);
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 
-       hash_destroy(&child_pids);
+       hash_table_destroy(&child_pids);
 }
index 0a3a52f52da08b72aae7efa798cd7b4abf85905c..c32059fb85ee43dfd38f32d6b6517256538fc7f6 100644 (file)
@@ -36,7 +36,7 @@ struct hash_iterate_context {
        unsigned int pos;
 };
 
-static bool hash_resize(struct hash_table *table, bool grow);
+static bool hash_table_resize(struct hash_table *table, bool grow);
 
 static int direct_cmp(const void *p1, const void *p2)
 {
@@ -50,8 +50,8 @@ static unsigned int direct_hash(const void *p)
 }
 
 struct hash_table *
-hash_create(pool_t table_pool, pool_t node_pool, unsigned int initial_size,
-           hash_callback_t *hash_cb, hash_cmp_callback_t *key_compare_cb)
+hash_table_create(pool_t table_pool, pool_t node_pool, unsigned int initial_size,
+                 hash_callback_t *hash_cb, hash_cmp_callback_t *key_compare_cb)
 {
        struct hash_table *table;
 
@@ -91,7 +91,7 @@ static void destroy_node_list(struct hash_table *table, struct hash_node *node)
        }
 }
 
-static void hash_destroy_nodes(struct hash_table *table)
+static void hash_table_destroy_nodes(struct hash_table *table)
 {
        unsigned int i;
 
@@ -101,14 +101,14 @@ static void hash_destroy_nodes(struct hash_table *table)
        }
 }
 
-void hash_destroy(struct hash_table **_table)
+void hash_table_destroy(struct hash_table **_table)
 {
        struct hash_table *table = *_table;
 
        *_table = NULL;
 
        if (!table->node_pool->alloconly_pool) {
-               hash_destroy_nodes(table);
+               hash_table_destroy_nodes(table);
                destroy_node_list(table, table->free_nodes);
        }
 
@@ -116,10 +116,10 @@ void hash_destroy(struct hash_table **_table)
        p_free(table->table_pool, table);
 }
 
-void hash_clear(struct hash_table *table, bool free_nodes)
+void hash_table_clear(struct hash_table *table, bool free_nodes)
 {
        if (!table->node_pool->alloconly_pool)
-               hash_destroy_nodes(table);
+               hash_table_destroy_nodes(table);
 
        if (free_nodes) {
                if (!table->node_pool->alloconly_pool)
@@ -134,8 +134,8 @@ void hash_clear(struct hash_table *table, bool free_nodes)
 }
 
 static struct hash_node *
-hash_lookup_node(const struct hash_table *table,
-                const void *key, unsigned int hash)
+hash_table_lookup_node(const struct hash_table *table,
+                      const void *key, unsigned int hash)
 {
        struct hash_node *node;
 
@@ -152,21 +152,22 @@ hash_lookup_node(const struct hash_table *table,
        return NULL;
 }
 
-void *hash_lookup(const struct hash_table *table, const void *key)
+void *hash_table_lookup(const struct hash_table *table, const void *key)
 {
        struct hash_node *node;
 
-       node = hash_lookup_node(table, key, table->hash_cb(key));
+       node = hash_table_lookup_node(table, key, table->hash_cb(key));
        return node != NULL ? node->value : NULL;
 }
 
-bool hash_lookup_full(const struct hash_table *table, const void *lookup_key,
-                     void **orig_key, void **value)
+bool hash_table_lookup_full(const struct hash_table *table,
+                           const void *lookup_key,
+                           void **orig_key, void **value)
 {
        struct hash_node *node;
 
-       node = hash_lookup_node(table, lookup_key,
-                               table->hash_cb(lookup_key));
+       node = hash_table_lookup_node(table, lookup_key,
+                                     table->hash_cb(lookup_key));
        if (node == NULL)
                return FALSE;
 
@@ -178,8 +179,8 @@ bool hash_lookup_full(const struct hash_table *table, const void *lookup_key,
 }
 
 static struct hash_node *
-hash_insert_node(struct hash_table *table, void *key, void *value,
-                bool check_existing)
+hash_table_insert_node(struct hash_table *table, void *key, void *value,
+                      bool check_existing)
 {
        struct hash_node *node, *prev;
        unsigned int hash;
@@ -190,7 +191,7 @@ hash_insert_node(struct hash_table *table, void *key, void *value,
 
        if (check_existing && table->removed_count > 0) {
                /* there may be holes, have to check everything */
-               node = hash_lookup_node(table, key, hash);
+               node = hash_table_lookup_node(table, key, hash);
                if (node != NULL) {
                        node->value = value;
                        return node;
@@ -234,9 +235,9 @@ hash_insert_node(struct hash_table *table, void *key, void *value,
        }
 
        if (node == NULL) {
-               if (table->frozen == 0 && hash_resize(table, TRUE)) {
+               if (table->frozen == 0 && hash_table_resize(table, TRUE)) {
                        /* resized table, try again */
-                       return hash_insert_node(table, key, value, FALSE);
+                       return hash_table_insert_node(table, key, value, FALSE);
                }
 
                if (table->free_nodes == NULL)
@@ -256,20 +257,21 @@ hash_insert_node(struct hash_table *table, void *key, void *value,
        return node;
 }
 
-void hash_insert(struct hash_table *table, void *key, void *value)
+void hash_table_insert(struct hash_table *table, void *key, void *value)
 {
        struct hash_node *node;
 
-       node = hash_insert_node(table, key, value, TRUE);
+       node = hash_table_insert_node(table, key, value, TRUE);
        node->key = key;
 }
 
-void hash_update(struct hash_table *table, void *key, void *value)
+void hash_table_update(struct hash_table *table, void *key, void *value)
 {
-       (void)hash_insert_node(table, key, value, TRUE);
+       (void)hash_table_insert_node(table, key, value, TRUE);
 }
 
-static void hash_compress(struct hash_table *table, struct hash_node *root)
+static void
+hash_table_compress(struct hash_table *table, struct hash_node *root)
 {
        struct hash_node *node, *next;
 
@@ -293,24 +295,24 @@ static void hash_compress(struct hash_table *table, struct hash_node *root)
        }
 }
 
-static void hash_compress_removed(struct hash_table *table)
+static void hash_table_compress_removed(struct hash_table *table)
 {
        unsigned int i;
 
        for (i = 0; i < table->size; i++)
-               hash_compress(table, &table->nodes[i]);
+               hash_table_compress(table, &table->nodes[i]);
 
         table->removed_count = 0;
 }
 
-void hash_remove(struct hash_table *table, const void *key)
+void hash_table_remove(struct hash_table *table, const void *key)
 {
        struct hash_node *node;
        unsigned int hash;
 
        hash = table->hash_cb(key);
 
-       node = hash_lookup_node(table, key, hash);
+       node = hash_table_lookup_node(table, key, hash);
        if (unlikely(node == NULL))
                i_panic("key not found from hash");
 
@@ -319,20 +321,20 @@ void hash_remove(struct hash_table *table, const void *key)
 
        if (table->frozen != 0)
                table->removed_count++;
-       else if (!hash_resize(table, FALSE))
-               hash_compress(table, &table->nodes[hash % table->size]);
+       else if (!hash_table_resize(table, FALSE))
+               hash_table_compress(table, &table->nodes[hash % table->size]);
 }
 
-unsigned int hash_count(const struct hash_table *table)
+unsigned int hash_table_count(const struct hash_table *table)
 {
        return table->nodes_count;
 }
 
-struct hash_iterate_context *hash_iterate_init(struct hash_table *table)
+struct hash_iterate_context *hash_table_iterate_init(struct hash_table *table)
 {
        struct hash_iterate_context *ctx;
 
-       hash_freeze(table);
+       hash_table_freeze(table);
 
        ctx = i_new(struct hash_iterate_context, 1);
        ctx->table = table;
@@ -340,8 +342,9 @@ struct hash_iterate_context *hash_iterate_init(struct hash_table *table)
        return ctx;
 }
 
-static struct hash_node *hash_iterate_next(struct hash_iterate_context *ctx,
-                                          struct hash_node *node)
+static struct hash_node *
+hash_table_iterate_next(struct hash_iterate_context *ctx,
+                       struct hash_node *node)
 {
        do {
                node = node->next;
@@ -357,14 +360,14 @@ static struct hash_node *hash_iterate_next(struct hash_iterate_context *ctx,
        return node;
 }
 
-bool hash_iterate(struct hash_iterate_context *ctx,
-                 void **key_r, void **value_r)
+bool hash_table_iterate(struct hash_iterate_context *ctx,
+                       void **key_r, void **value_r)
 {
        struct hash_node *node;
 
        node = ctx->next;
        if (node != NULL && node->key == NULL)
-               node = hash_iterate_next(ctx, node);
+               node = hash_table_iterate_next(ctx, node);
        if (node == NULL) {
                *key_r = *value_r = NULL;
                return FALSE;
@@ -372,25 +375,25 @@ bool hash_iterate(struct hash_iterate_context *ctx,
        *key_r = node->key;
        *value_r = node->value;
 
-       ctx->next = hash_iterate_next(ctx, node);
+       ctx->next = hash_table_iterate_next(ctx, node);
        return TRUE;
 }
 
-void hash_iterate_deinit(struct hash_iterate_context **_ctx)
+void hash_table_iterate_deinit(struct hash_iterate_context **_ctx)
 {
        struct hash_iterate_context *ctx = *_ctx;
 
        *_ctx = NULL;
-       hash_thaw(ctx->table);
+       hash_table_thaw(ctx->table);
        i_free(ctx);
 }
 
-void hash_freeze(struct hash_table *table)
+void hash_table_freeze(struct hash_table *table)
 {
        table->frozen++;
 }
 
-void hash_thaw(struct hash_table *table)
+void hash_table_thaw(struct hash_table *table)
 {
        i_assert(table->frozen > 0);
 
@@ -398,12 +401,12 @@ void hash_thaw(struct hash_table *table)
                return;
 
        if (table->removed_count > 0) {
-               if (!hash_resize(table, FALSE))
-                       hash_compress_removed(table);
+               if (!hash_table_resize(table, FALSE))
+                       hash_table_compress_removed(table);
        }
 }
 
-static bool hash_resize(struct hash_table *table, bool grow)
+static bool hash_table_resize(struct hash_table *table, bool grow)
 {
        struct hash_node *old_nodes, *node, *next;
        unsigned int next_size, old_size, i;
@@ -436,15 +439,17 @@ static bool hash_resize(struct hash_table *table, bool grow)
        /* move the data */
        for (i = 0; i < old_size; i++) {
                node = &old_nodes[i];
-               if (node->key != NULL)
-                       hash_insert_node(table, node->key, node->value, FALSE);
+               if (node->key != NULL) {
+                       hash_table_insert_node(table, node->key,
+                                              node->value, FALSE);
+               }
 
                for (node = node->next; node != NULL; node = next) {
                        next = node->next;
 
                        if (node->key != NULL) {
-                               hash_insert_node(table, node->key,
-                                                node->value, FALSE);
+                               hash_table_insert_node(table, node->key,
+                                                      node->value, FALSE);
                        }
                        free_node(table, node);
                }
@@ -456,19 +461,19 @@ static bool hash_resize(struct hash_table *table, bool grow)
        return TRUE;
 }
 
-void hash_copy(struct hash_table *dest, struct hash_table *src)
+void hash_table_copy(struct hash_table *dest, struct hash_table *src)
 {
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       hash_freeze(dest);
+       hash_table_freeze(dest);
 
-       iter = hash_iterate_init(src);
-       while (hash_iterate(iter, &key, &value))
-               hash_insert(dest, key, value);
-       hash_iterate_deinit(&iter);
+       iter = hash_table_iterate_init(src);
+       while (hash_table_iterate(iter, &key, &value))
+               hash_table_insert(dest, key, value);
+       hash_table_iterate_deinit(&iter);
 
-       hash_thaw(dest);
+       hash_table_thaw(dest);
 }
 
 /* a char* hash function from ASU -- from glib */
index d118f2a41c6885c5795273159821db18718dc176..a7a7ae3a44a114b22bc22125441490a1ca4e8c58 100644 (file)
@@ -11,43 +11,45 @@ typedef int hash_cmp_callback_t(const void *p1, const void *p2);
 
    table_pool is used to allocate/free large hash tables, node_pool is used
    for smaller allocations and can also be alloconly pool. The pools must not
-   be free'd before hash_destroy() is called. */
+   be free'd before hash_table_destroy() is called. */
+/* APPLE - renamed from hash_create/hash_destroy to avoid libc conflict */
 struct hash_table *
-hash_create(pool_t table_pool, pool_t node_pool, unsigned int initial_size,
-           hash_callback_t *hash_cb, hash_cmp_callback_t *key_compare_cb);
-void hash_destroy(struct hash_table **table);
+hash_table_create(pool_t table_pool, pool_t node_pool, unsigned int initial_size,
+                 hash_callback_t *hash_cb, hash_cmp_callback_t *key_compare_cb);
+void hash_table_destroy(struct hash_table **table);
 /* Remove all nodes from hash table. If free_collisions is TRUE, the
    memory allocated from node_pool is freed, or discarded with
    alloconly pools. */
-void hash_clear(struct hash_table *table, bool free_collisions);
+void hash_table_clear(struct hash_table *table, bool free_collisions);
 
-void *hash_lookup(const struct hash_table *table, const void *key) ATTR_PURE;
-bool hash_lookup_full(const struct hash_table *table, const void *lookup_key,
-                     void **orig_key, void **value);
+void *hash_table_lookup(const struct hash_table *table, const void *key) ATTR_PURE;
+bool hash_table_lookup_full(const struct hash_table *table,
+                           const void *lookup_key,
+                           void **orig_key, void **value);
 
-/* Insert/update node in hash table. The difference is that hash_insert()
-   replaces the key in table to given one, while hash_update() doesnt. */
-void hash_insert(struct hash_table *table, void *key, void *value);
-void hash_update(struct hash_table *table, void *key, void *value);
+/* Insert/update node in hash table. The difference is that hash_table_insert()
+   replaces the key in table to given one, while hash_table_update() doesnt. */
+void hash_table_insert(struct hash_table *table, void *key, void *value);
+void hash_table_update(struct hash_table *table, void *key, void *value);
 
-void hash_remove(struct hash_table *table, const void *key);
-unsigned int hash_count(const struct hash_table *table) ATTR_PURE;
+void hash_table_remove(struct hash_table *table, const void *key);
+unsigned int hash_table_count(const struct hash_table *table) ATTR_PURE;
 
-/* Iterates through all nodes in hash table. You may safely call hash_*()
+/* Iterates through all nodes in hash table. You may safely call hash_table_*()
    functions while iterating, but if you add any new nodes, they may or may
    not be called for in this iteration. */
-struct hash_iterate_context *hash_iterate_init(struct hash_table *table);
-bool hash_iterate(struct hash_iterate_context *ctx,
-                 void **key_r, void **value_r);
-void hash_iterate_deinit(struct hash_iterate_context **ctx);
+struct hash_iterate_context *hash_table_iterate_init(struct hash_table *table);
+bool hash_table_iterate(struct hash_iterate_context *ctx,
+                       void **key_r, void **value_r);
+void hash_table_iterate_deinit(struct hash_iterate_context **ctx);
 
 /* Hash table isn't resized, and removed nodes aren't removed from
    the list while hash table is freezed. Supports nesting. */
-void hash_freeze(struct hash_table *table);
-void hash_thaw(struct hash_table *table);
+void hash_table_freeze(struct hash_table *table);
+void hash_table_thaw(struct hash_table *table);
 
 /* Copy all nodes from one hash table to another */
-void hash_copy(struct hash_table *dest, struct hash_table *src);
+void hash_table_copy(struct hash_table *dest, struct hash_table *src);
 
 /* hash function for strings */
 unsigned int str_hash(const void *p) ATTR_PURE;
index cb735c802cdc291e5e2f25929d0b860cad282ee9..3bc7c516f35f8ed92b43dedf40cad128b20a4245 100644 (file)
@@ -46,11 +46,11 @@ static void request_handle(struct master_login_reply *reply)
                return;
        }
 
-       client = hash_lookup(master_requests, POINTER_CAST(reply->tag));
+       client = hash_table_lookup(master_requests, POINTER_CAST(reply->tag));
        if (client == NULL)
                i_fatal("Master sent reply with unknown tag %u", reply->tag);
 
-       hash_remove(master_requests, POINTER_CAST(reply->tag));
+       hash_table_remove(master_requests, POINTER_CAST(reply->tag));
        if (client != &destroyed_client) {
                client_call_master_callback(client, reply);
                /* NOTE: client may be destroyed now */
@@ -119,7 +119,7 @@ void master_request_login(struct client *client, master_callback_t *callback,
        client->master_tag = req->tag;
        client->master_callback = callback;
 
-       hash_insert(master_requests, POINTER_CAST(req->tag), client);
+       hash_table_insert(master_requests, POINTER_CAST(req->tag), client);
 }
 
 void master_request_abort(struct client *client)
@@ -128,8 +128,8 @@ void master_request_abort(struct client *client)
 
        /* we're still going to get the reply from the master, so just
           remember that we want to ignore it */
-       hash_update(master_requests, POINTER_CAST(client->master_tag),
-                   &destroyed_client);
+       hash_table_update(master_requests, POINTER_CAST(client->master_tag),
+                         &destroyed_client);
 
        memset(&reply, 0, sizeof(reply));
        reply.status = MASTER_LOGIN_STATUS_INTERNAL_ERROR;
@@ -295,8 +295,8 @@ void master_init(int fd)
        main_ref();
 
        master_fd = fd;
-       master_requests = hash_create(system_pool, system_pool,
-                                     0, NULL, NULL);
+       master_requests = hash_table_create(system_pool, system_pool,
+                                           0, NULL, NULL);
 
         master_pos = 0;
        io_master = io_add(master_fd, IO_READ, master_input, NULL);
@@ -304,7 +304,7 @@ void master_init(int fd)
 
 void master_deinit(void)
 {
-       hash_destroy(&master_requests);
+       hash_table_destroy(&master_requests);
 
        if (io_master != NULL)
                io_remove(&io_master);
index 8232edf9c4f8cb9c61c4d71f1ed0a358c55da75e..1e1c5fb0945f118ab4fcb3e9712260af10ddf8a9 100644 (file)
@@ -140,7 +140,7 @@ static int ssl_proxy_destroy(struct ssl_proxy *proxy)
        if (--proxy->refcount > 0)
                return TRUE;
 
-       hash_remove(ssl_proxies, proxy);
+       hash_table_remove(ssl_proxies, proxy);
 
        gnutls_deinit(proxy->session);
 
@@ -332,7 +332,7 @@ int ssl_proxy_new(int fd, struct ip_addr *ip)
        proxy->fd_plain = sfd[0];
        proxy->ip = *ip;
 
-       hash_insert(ssl_proxies, proxy, proxy);
+       hash_table_insert(ssl_proxies, proxy, proxy);
 
        proxy->refcount++;
        ssl_handshake(proxy);
@@ -519,7 +519,8 @@ void ssl_proxy_init(void)
         gnutls_certificate_set_dh_params(x509_cred, dh_params);
         gnutls_certificate_set_rsa_export_params(x509_cred, rsa_params);
 
-        ssl_proxies = hash_create(system_pool, system_pool, 0, NULL, NULL);
+       ssl_proxies = hash_table_create(system_pool, system_pool, 0,
+                                       NULL, NULL);
        ssl_initialized = TRUE;
 }
 
@@ -531,11 +532,11 @@ void ssl_proxy_deinit(void)
        if (!ssl_initialized)
                return;
 
-       iter = hash_iterate_init(ssl_proxies);
-       while (hash_iterate(iter, &key, &value))
+       iter = hash_table_iterate_init(ssl_proxies);
+       while (hash_table_iterate(iter, &key, &value))
                ssl_proxy_destroy(value);
-       hash_iterate_deinit(iter);
-       hash_destroy(ssl_proxies);
+       hash_table_iterate_deinit(iter);
+       hash_table_destroy(ssl_proxies);
 
        gnutls_certificate_free_credentials(x509_cred);
        gnutls_global_deinit();
index 8d9be506885952db24bbb9abed0a6c8baff7515f..c66aef540b12c2263ba6c67525d5226bf5719d06 100644 (file)
@@ -98,7 +98,8 @@ void auth_process_request(struct auth_process *process, unsigned int login_pid,
                }
                auth_process_destroy(process);
        } else {
-               hash_insert(process->requests, POINTER_CAST(auth_tag), request);
+               hash_table_insert(process->requests,
+                                 POINTER_CAST(auth_tag), request);
        }
 }
 
@@ -119,7 +120,7 @@ auth_process_input_user(struct auth_process *process, const char *args)
        }
        id = (unsigned int)strtoul(list[0], NULL, 10);
 
-       request = hash_lookup(process->requests, POINTER_CAST(id));
+       request = hash_table_lookup(process->requests, POINTER_CAST(id));
        if (request == NULL) {
                i_error("BUG: Auth process %s sent unrequested reply with ID "
                        "%u", dec2str(process->pid), id);
@@ -138,7 +139,7 @@ auth_process_input_user(struct auth_process *process, const char *args)
        }
 
        auth_master_callback(list[1], list + 2, request);
-       hash_remove(process->requests, POINTER_CAST(id));
+       hash_table_remove(process->requests, POINTER_CAST(id));
        return TRUE;
 }
 
@@ -150,7 +151,7 @@ auth_process_input_notfound(struct auth_process *process, const char *args)
 
        id = (unsigned int)strtoul(args, NULL, 10);
 
-       request = hash_lookup(process->requests, POINTER_CAST(id));
+       request = hash_table_lookup(process->requests, POINTER_CAST(id));
        if (request == NULL) {
                i_error("BUG: Auth process %s sent unrequested reply with ID "
                        "%u", dec2str(process->pid), id);
@@ -158,7 +159,7 @@ auth_process_input_notfound(struct auth_process *process, const char *args)
        }
 
        auth_master_callback(NULL, NULL, request);
-       hash_remove(process->requests, POINTER_CAST(id));
+       hash_table_remove(process->requests, POINTER_CAST(id));
        return TRUE;
 }
 
@@ -204,7 +205,7 @@ auth_process_input_fail(struct auth_process *process, const char *args)
 
        id = (unsigned int)strtoul(args, NULL, 10);
 
-       request = hash_lookup(process->requests, POINTER_CAST(id));
+       request = hash_table_lookup(process->requests, POINTER_CAST(id));
        if (request == NULL) {
                i_error("BUG: Auth process %s sent unrequested reply with ID "
                        "%u", dec2str(process->pid), id);
@@ -212,7 +213,7 @@ auth_process_input_fail(struct auth_process *process, const char *args)
        }
 
        auth_master_callback(NULL, NULL, request);
-       hash_remove(process->requests, POINTER_CAST(id));
+       hash_table_remove(process->requests, POINTER_CAST(id));
        return TRUE;
 }
 
@@ -314,7 +315,8 @@ auth_process_new(pid_t pid, int fd, struct auth_process_group *group)
        p->io = io_add(fd, IO_READ, auth_process_input, p);
        p->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE);
        p->output = o_stream_create_fd(fd, MAX_OUTBUF_SIZE, FALSE);
-       p->requests = hash_create(default_pool, default_pool, 0, NULL, NULL);
+       p->requests = hash_table_create(default_pool, default_pool, 0,
+                                       NULL, NULL);
 
        group->process_count++;
 
@@ -377,11 +379,11 @@ static void auth_process_destroy(struct auth_process *p)
        if (close(p->worker_listen_fd) < 0)
                i_error("close(worker_listen) failed: %m");
 
-       iter = hash_iterate_init(p->requests);
-       while (hash_iterate(iter, &key, &value))
+       iter = hash_table_iterate_init(p->requests);
+       while (hash_table_iterate(iter, &key, &value))
                auth_master_callback(NULL, NULL, value);
-       hash_iterate_deinit(&iter);
-       hash_destroy(&p->requests);
+       hash_table_iterate_deinit(&iter);
+       hash_table_destroy(&p->requests);
 
        i_stream_destroy(&p->input);
        o_stream_destroy(&p->output);
index 8a13884fbfde24bfc97e7f5e8e1b95c295cc7406..c1cb032bbefdd63eef6c4a082c14a543bae64fc9 100644 (file)
@@ -27,17 +27,17 @@ static child_process_destroy_callback_t *destroy_callbacks[PROCESS_TYPE_MAX];
 
 struct child_process *child_process_lookup(pid_t pid)
 {
-       return hash_lookup(processes, POINTER_CAST(pid));
+       return hash_table_lookup(processes, POINTER_CAST(pid));
 }
 
 void child_process_add(pid_t pid, struct child_process *process)
 {
-       hash_insert(processes, POINTER_CAST(pid), process);
+       hash_table_insert(processes, POINTER_CAST(pid), process);
 }
 
 void child_process_remove(pid_t pid)
 {
-       hash_remove(processes, POINTER_CAST(pid));
+       hash_table_remove(processes, POINTER_CAST(pid));
 }
 
 void child_process_init_env(void)
@@ -198,7 +198,7 @@ void child_process_set_destroy_callback(enum process_type type,
 
 void child_processes_init(void)
 {
-       processes = hash_create(default_pool, default_pool, 128, NULL, NULL);
+       processes = hash_table_create(default_pool, default_pool, 128, NULL, NULL);
        lib_signals_set_handler(SIGCHLD, TRUE, sigchld_handler, NULL);
 }
 
@@ -207,5 +207,5 @@ void child_processes_deinit(void)
        /* make sure we log if child processes died unexpectedly */
        sigchld_handler(SIGCHLD, NULL);
        lib_signals_unset_handler(SIGCHLD, sigchld_handler, NULL);
-       hash_destroy(&processes);
+       hash_table_destroy(&processes);
 }
index d6284b976c5654bbb3defc687f4e135f3e25b28d..dc61b79b318d6c18948d129b0f0d4eb6e13ad08f 100644 (file)
@@ -757,14 +757,14 @@ void login_processes_destroy_all(void)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(processes);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(processes);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct login_process *p = value;
 
                if (p->process.type == PROCESS_TYPE_LOGIN)
                        login_process_destroy(p);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 
        while (login_groups != NULL) {
                struct login_group *group = login_groups;
@@ -782,14 +782,14 @@ static void login_processes_notify_group(struct login_group *group)
 
        memset(&reply, 0, sizeof(reply));
 
-       iter = hash_iterate_init(processes);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(processes);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct login_process *p = value;
 
                if (p->process.type == PROCESS_TYPE_LOGIN && p->group == group)
                        (void)o_stream_send(p->output, &reply, sizeof(reply));
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 }
 
 static int login_group_start_missings(struct login_group *group)
index f9a18797cae5ddbdc866f3952f1204a123b2d9f0..5acde2773943a2553f371c7c23fc59e8dca08f23 100644 (file)
@@ -78,7 +78,7 @@ mail_process_group_lookup(enum process_type type, const char *user,
        lookup_group.user = t_strdup_noconst(user);
        lookup_group.remote_ip = *ip;
 
-       return hash_lookup(mail_process_groups, &lookup_group);
+       return hash_table_lookup(mail_process_groups, &lookup_group);
 }
 
 static struct mail_process_group *
@@ -93,7 +93,7 @@ mail_process_group_create(enum process_type type, const char *user,
        group->remote_ip = *ip;
 
        i_array_init(&group->processes, 10);
-       hash_insert(mail_process_groups, group, group);
+       hash_table_insert(mail_process_groups, group, group);
        return group;
 }
 
@@ -922,7 +922,7 @@ mail_process_destroyed(struct child_process *process,
        if (count == 1) {
                /* last process in this group */
                i_assert(pids[0] == pid);
-               hash_remove(mail_process_groups, group);
+               hash_table_remove(mail_process_groups, group);
                mail_process_group_free(group);
        } else {
                for (i = 0; i < count; i++) {
@@ -938,9 +938,9 @@ mail_process_destroyed(struct child_process *process,
 
 void mail_processes_init(void)
 {
-       mail_process_groups = hash_create(default_pool, default_pool, 0,
-                                         mail_process_group_hash,
-                                         mail_process_group_cmp);
+       mail_process_groups = hash_table_create(default_pool, default_pool, 0,
+                                               mail_process_group_hash,
+                                               mail_process_group_cmp);
 
        child_process_set_destroy_callback(PROCESS_TYPE_IMAP,
                                           mail_process_destroyed);
@@ -953,12 +953,12 @@ void mail_processes_deinit(void)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(mail_process_groups);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(mail_process_groups);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct mail_process_group *group = value;
                mail_process_group_free(group);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 
-       hash_destroy(&mail_process_groups);
+       hash_table_destroy(&mail_process_groups);
 }
index fedc80a36f8587e23ea26de0f9c2d61d1fc50211..46d6d652f0a1233bd5641bbe41681073634014c7 100644 (file)
@@ -47,11 +47,11 @@ struct acl_cache *acl_cache_init(struct acl_backend *backend,
        cache->validity_rec_size = validity_rec_size;
        cache->right_names_pool =
                pool_alloconly_create("ACL right names", 1024);
-       cache->objects = hash_create(default_pool, default_pool, 0,
-                                    str_hash, (hash_cmp_callback_t *)strcmp);
+       cache->objects = hash_table_create(default_pool, default_pool, 0,
+                                          str_hash, (hash_cmp_callback_t *)strcmp);
        cache->right_name_idx_map =
-               hash_create(default_pool, cache->right_names_pool, 0,
-                           str_hash, (hash_cmp_callback_t *)strcmp);
+               hash_table_create(default_pool, cache->right_names_pool, 0,
+                                 str_hash, (hash_cmp_callback_t *)strcmp);
        i_array_init(&cache->right_idx_name_map, DEFAULT_ACL_RIGHTS_COUNT);
        return cache;
 }
@@ -64,8 +64,8 @@ void acl_cache_deinit(struct acl_cache **_cache)
 
        acl_cache_flush_all(cache);
        array_free(&cache->right_idx_name_map);
-       hash_destroy(&cache->right_name_idx_map);
-       hash_destroy(&cache->objects);
+       hash_table_destroy(&cache->right_name_idx_map);
+       hash_table_destroy(&cache->objects);
        pool_unref(&cache->right_names_pool);
        i_free(cache);
 }
@@ -145,15 +145,15 @@ unsigned int acl_cache_right_lookup(struct acl_cache *cache, const char *right)
 
        /* use +1 for right_name_idx_map values because we can't add NULL
           values. */
-       idx_p = hash_lookup(cache->right_name_idx_map, right);
+       idx_p = hash_table_lookup(cache->right_name_idx_map, right);
        if (idx_p == NULL) {
                /* new right name, add it */
                const_name = name = p_strdup(cache->right_names_pool, right);
 
                idx = array_count(&cache->right_idx_name_map);
                array_append(&cache->right_idx_name_map, &const_name, 1);
-               hash_insert(cache->right_name_idx_map, name,
-                           POINTER_CAST(idx + 1));
+               hash_table_insert(cache->right_name_idx_map, name,
+                                 POINTER_CAST(idx + 1));
        } else {
                idx = POINTER_CAST_TO(idx_p, unsigned int)-1;
        }
@@ -164,9 +164,9 @@ void acl_cache_flush(struct acl_cache *cache, const char *objname)
 {
        struct acl_object_cache *obj_cache;
 
-       obj_cache = hash_lookup(cache->objects, objname);
+       obj_cache = hash_table_lookup(cache->objects, objname);
        if (obj_cache != NULL) {
-               hash_remove(cache->objects, objname);
+               hash_table_remove(cache->objects, objname);
                acl_cache_free_object_cache(obj_cache);
        }
 }
@@ -176,15 +176,15 @@ void acl_cache_flush_all(struct acl_cache *cache)
        struct hash_iterate_context *iter;
        void *key, *value;
 
-       iter = hash_iterate_init(cache->objects);
-       while (hash_iterate(iter, &key, &value)) {
+       iter = hash_table_iterate_init(cache->objects);
+       while (hash_table_iterate(iter, &key, &value)) {
                struct acl_object_cache *obj_cache = value;
 
                acl_cache_free_object_cache(obj_cache);
        }
-       hash_iterate_deinit(&iter);
+       hash_table_iterate_deinit(&iter);
 
-       hash_clear(cache->objects, FALSE);
+       hash_table_clear(cache->objects, FALSE);
 }
 
 static void
@@ -271,12 +271,12 @@ acl_cache_object_get(struct acl_cache *cache, const char *objname,
 {
        struct acl_object_cache *obj_cache;
 
-       obj_cache = hash_lookup(cache->objects, objname);
+       obj_cache = hash_table_lookup(cache->objects, objname);
        if (obj_cache == NULL) {
                obj_cache = i_malloc(sizeof(struct acl_object_cache) +
                                     cache->validity_rec_size);
                obj_cache->name = i_strdup(objname);
-               hash_insert(cache->objects, obj_cache->name, obj_cache);
+               hash_table_insert(cache->objects, obj_cache->name, obj_cache);
                *created_r = TRUE;
        } else {
                *created_r = FALSE;
@@ -362,7 +362,7 @@ void *acl_cache_get_validity(struct acl_cache *cache, const char *objname)
 {
        struct acl_object_cache *obj_cache;
 
-       obj_cache = hash_lookup(cache->objects, objname);
+       obj_cache = hash_table_lookup(cache->objects, objname);
        return obj_cache == NULL ? NULL : (obj_cache + 1);
 }
 
@@ -404,7 +404,7 @@ acl_cache_get_my_rights(struct acl_cache *cache, const char *objname)
 {
        struct acl_object_cache *obj_cache;
 
-       obj_cache = hash_lookup(cache->objects, objname);
+       obj_cache = hash_table_lookup(cache->objects, objname);
        if (obj_cache == NULL ||
            obj_cache->my_current_rights == &negative_cache_entry)
                return NULL;