# HG changeset patch # User Timo Sirainen # Date 1229670398 -7200 # Node ID f9166a09423af143002da9517b9234efd02c5808 # Parent 9ec2882243a663b25f7e9af184c0f540d8fc8308 Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h Based on patch by Apple. diff -r 9ec2882243a6 -r f9166a09423a src/auth/auth-cache.c --- a/src/auth/auth-cache.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/auth-cache.c Fri Dec 19 09:06:38 2008 +0200 @@ -86,7 +86,7 @@ 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 *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 @@ 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 @@ { 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_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 @@ 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 @@ 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 @@ 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; diff -r 9ec2882243a6 -r f9166a09423a src/auth/auth-request-handler.c --- a/src/auth/auth-request-handler.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/auth-request-handler.c Fri Dec 19 09:06:38 2008 +0200 @@ -52,7 +52,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/auth/db-ldap.c --- a/src/auth/db-ldap.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/db-ldap.c Fri Dec 19 09:06:38 2008 +0200 @@ -917,13 +917,13 @@ 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 @@ 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 @@ 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 @@ 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); } diff -r 9ec2882243a6 -r f9166a09423a src/auth/db-passwd-file.c --- a/src/auth/db-passwd-file.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/db-passwd-file.c Fri Dec 19 09:06:38 2008 +0200 @@ -29,7 +29,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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_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->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 @@ 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 @@ 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 @@ "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; diff -r 9ec2882243a6 -r f9166a09423a src/auth/otp-skey-common.c --- a/src/auth/otp-skey-common.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/otp-skey-common.c Fri Dec 19 09:06:38 2008 +0200 @@ -20,17 +20,17 @@ 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 @@ if (!request->lock) return; - hash_remove(otp_lock_table, auth_request->user); + hash_table_remove(otp_lock_table, auth_request->user); request->lock = FALSE; } diff -r 9ec2882243a6 -r f9166a09423a src/auth/passdb-checkpassword.c --- a/src/auth/passdb-checkpassword.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/passdb-checkpassword.c Fri Dec 19 09:06:38 2008 +0200 @@ -25,7 +25,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/auth/passdb-ldap.c --- a/src/auth/passdb-ldap.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/passdb-ldap.c Fri Dec 19 09:06:38 2008 +0200 @@ -380,8 +380,8 @@ 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, diff -r 9ec2882243a6 -r f9166a09423a src/auth/userdb-checkpassword.c --- a/src/auth/userdb-checkpassword.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/userdb-checkpassword.c Fri Dec 19 09:06:38 2008 +0200 @@ -25,7 +25,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/auth/userdb-ldap.c --- a/src/auth/userdb-ldap.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/auth/userdb-ldap.c Fri Dec 19 09:06:38 2008 +0200 @@ -123,8 +123,8 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/deliver/duplicate.c --- a/src/deliver/duplicate.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/deliver/duplicate.c Fri Dec 19 09:06:38 2008 +0200 @@ -144,14 +144,15 @@ 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 @@ &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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; diff -r 9ec2882243a6 -r f9166a09423a src/lib-auth/auth-server-connection.c --- a/src/lib-auth/auth-server-connection.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-auth/auth-server-connection.c Fri Dec 19 09:06:38 2008 +0200 @@ -248,7 +248,7 @@ 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 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/lib-auth/auth-server-request.c --- a/src/lib-auth/auth-server-request.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-auth/auth-server-request.c Fri Dec 19 09:06:38 2008 +0200 @@ -62,8 +62,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 *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); diff -r 9ec2882243a6 -r f9166a09423a src/lib-dict/dict-file.c --- a/src/lib-dict/dict-file.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-dict/dict-file.c Fri Dec 19 09:06:38 2008 +0200 @@ -74,8 +74,8 @@ 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 @@ { 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 @@ 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 @@ (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 @@ 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 @@ 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 @@ (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 @@ 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 @@ 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 @@ 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 @@ 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, diff -r 9ec2882243a6 -r f9166a09423a src/lib-index/mail-cache-fields.c --- a/src/lib-index/mail-cache-fields.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-index/mail-cache-fields.c Fri Dec 19 09:06:38 2008 +0200 @@ -76,8 +76,9 @@ 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 @@ 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 @@ { 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 @@ 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) { diff -r 9ec2882243a6 -r f9166a09423a src/lib-index/mail-cache.c --- a/src/lib-index/mail-cache.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-index/mail-cache.c Fri Dec 19 09:06:38 2008 +0200 @@ -409,8 +409,8 @@ 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 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/lib-index/mail-index.c --- a/src/lib-index/mail-index.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-index/mail-index.c Fri Dec 19 09:06:38 2008 +0200 @@ -49,8 +49,8 @@ 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 @@ 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 @@ /* 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 @@ 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); } diff -r 9ec2882243a6 -r f9166a09423a src/lib-sql/sql-pool.c --- a/src/lib-sql/sql-pool.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-sql/sql-pool.c Fri Dec 19 09:06:38 2008 +0200 @@ -90,7 +90,7 @@ 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 @@ 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 *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 @@ struct sql_pool *pool = *_pool; *_pool = NULL; - hash_destroy(&pool->dbs); + hash_table_destroy(&pool->dbs); i_free(pool); } diff -r 9ec2882243a6 -r f9166a09423a src/lib-storage/index/dbox/dbox-sync.c --- a/src/lib-storage/index/dbox/dbox-sync.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-storage/index/dbox/dbox-sync.c Fri Dec 19 09:06:38 2008 +0200 @@ -29,7 +29,7 @@ &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 @@ 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 @@ /* 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 @@ 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 @@ 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; } diff -r 9ec2882243a6 -r f9166a09423a src/lib-storage/index/index-thread-finish.c --- a/src/lib-storage/index/index-thread-finish.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-storage/index/index-thread-finish.c Fri Dec 19 09:06:38 2008 +0200 @@ -79,12 +79,12 @@ /* (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 @@ (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 @@ 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 @@ } 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); } diff -r 9ec2882243a6 -r f9166a09423a src/lib-storage/index/maildir/maildir-keywords.c --- a/src/lib-storage/index/maildir/maildir-keywords.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-storage/index/maildir/maildir-keywords.c Fri Dec 19 09:06:38 2008 +0200 @@ -71,8 +71,8 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ { 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 @@ 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 @@ 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; diff -r 9ec2882243a6 -r f9166a09423a src/lib-storage/index/maildir/maildir-uidlist.c --- a/src/lib-storage/index/maildir/maildir-uidlist.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib-storage/index/maildir/maildir-uidlist.c Fri Dec 19 09:06:38 2008 +0200 @@ -228,9 +228,9 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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 @@ { 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 @@ { 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 @@ 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 @@ 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 @@ { 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; diff -r 9ec2882243a6 -r f9166a09423a src/lib/child-wait.c --- a/src/lib/child-wait.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib/child-wait.c Fri Dec 19 09:06:38 2008 +0200 @@ -42,15 +42,15 @@ 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_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 @@ 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 @@ 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 @@ 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); } diff -r 9ec2882243a6 -r f9166a09423a src/lib/hash.c --- a/src/lib/hash.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib/hash.c Fri Dec 19 09:06:38 2008 +0200 @@ -36,7 +36,7 @@ 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 @@ } 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 hash_destroy_nodes(struct hash_table *table) +static void hash_table_destroy_nodes(struct hash_table *table) { unsigned int i; @@ -101,14 +101,14 @@ } } -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 @@ 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 @@ } 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 @@ 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 @@ } 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 @@ 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 @@ } 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 @@ 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_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 @@ 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 @@ 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 @@ 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 @@ *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 @@ 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 @@ /* 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 @@ 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 */ diff -r 9ec2882243a6 -r f9166a09423a src/lib/hash.h --- a/src/lib/hash.h Fri Dec 19 08:50:14 2008 +0200 +++ b/src/lib/hash.h Fri Dec 19 09:06:38 2008 +0200 @@ -11,43 +11,45 @@ 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; diff -r 9ec2882243a6 -r f9166a09423a src/login-common/master.c --- a/src/login-common/master.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/login-common/master.c Fri Dec 19 09:06:38 2008 +0200 @@ -46,11 +46,11 @@ 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 @@ 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 @@ /* 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 @@ 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_deinit(void) { - hash_destroy(&master_requests); + hash_table_destroy(&master_requests); if (io_master != NULL) io_remove(&io_master); diff -r 9ec2882243a6 -r f9166a09423a src/login-common/ssl-proxy-gnutls.c --- a/src/login-common/ssl-proxy-gnutls.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/login-common/ssl-proxy-gnutls.c Fri Dec 19 09:06:38 2008 +0200 @@ -140,7 +140,7 @@ 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 @@ 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 @@ 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 @@ 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(); diff -r 9ec2882243a6 -r f9166a09423a src/master/auth-process.c --- a/src/master/auth-process.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/master/auth-process.c Fri Dec 19 09:06:38 2008 +0200 @@ -98,7 +98,8 @@ } 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 @@ } 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_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 @@ 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_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 @@ 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_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 @@ 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 @@ 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); diff -r 9ec2882243a6 -r f9166a09423a src/master/child-process.c --- a/src/master/child-process.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/master/child-process.c Fri Dec 19 09:06:38 2008 +0200 @@ -27,17 +27,17 @@ 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_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 @@ /* 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); } diff -r 9ec2882243a6 -r f9166a09423a src/master/login-process.c --- a/src/master/login-process.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/master/login-process.c Fri Dec 19 09:06:38 2008 +0200 @@ -757,14 +757,14 @@ 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 @@ 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) diff -r 9ec2882243a6 -r f9166a09423a src/master/mail-process.c --- a/src/master/mail-process.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/master/mail-process.c Fri Dec 19 09:06:38 2008 +0200 @@ -78,7 +78,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); } diff -r 9ec2882243a6 -r f9166a09423a src/plugins/acl/acl-cache.c --- a/src/plugins/acl/acl-cache.c Fri Dec 19 08:50:14 2008 +0200 +++ b/src/plugins/acl/acl-cache.c Fri Dec 19 09:06:38 2008 +0200 @@ -47,11 +47,11 @@ 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 @@ 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 @@ /* 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 @@ { 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 @@ 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 @@ { 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 @@ { 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 @@ { 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;