From d67280b3288aae81a8fbb2cd05e7923df793a853 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Fri, 19 Dec 2008 10:25:46 +0100
Subject: [PATCH] Adapted to changes in the Dovecot API.

---
 .../plugins/include/ext-include-binary.c      | 28 +++++++++----------
 .../plugins/variables/ext-variables-common.c  | 18 ++++++------
 src/lib-sieve/sieve-extensions.c              | 22 +++++++--------
 src/lib-sieve/sieve-result.c                  | 12 ++++----
 src/lib-sieve/sieve-validator.c               |  8 +++---
 5 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/lib-sieve/plugins/include/ext-include-binary.c b/src/lib-sieve/plugins/include/ext-include-binary.c
index a722e20e1..8d9002744 100644
--- a/src/lib-sieve/plugins/include/ext-include-binary.c
+++ b/src/lib-sieve/plugins/include/ext-include-binary.c
@@ -64,7 +64,7 @@ static struct ext_include_binary_context *ext_include_binary_create_context
 		p_new(pool, struct ext_include_binary_context, 1);
 	
 	ctx->binary = sbin;			
-	ctx->included_scripts = hash_create(default_pool, pool, 0, 
+	ctx->included_scripts = hash_table_create(default_pool, pool, 0, 
 		(hash_callback_t *) sieve_script_hash, 
 		(hash_cmp_callback_t *) sieve_script_cmp);
 	p_array_init(&ctx->include_index, pool, 128);
@@ -129,7 +129,7 @@ const struct ext_include_script_info *ext_include_binary_script_include
 	/* Unreferenced on binary_free */
 	sieve_script_ref(script);
 	
-	hash_insert(binctx->included_scripts, (void *) script, (void *) incscript);
+	hash_table_insert(binctx->included_scripts, (void *) script, (void *) incscript);
 	array_append(&binctx->include_index, &incscript, 1);
 
 	return incscript;
@@ -140,7 +140,7 @@ bool ext_include_binary_script_is_included
 	const struct ext_include_script_info **script_info_r)
 {
 	struct ext_include_script_info *incscript = (struct ext_include_script_info *)
-		hash_lookup(binctx->included_scripts, script);
+		hash_table_lookup(binctx->included_scripts, script);
 		
 	if ( incscript == NULL )
 		return FALSE;
@@ -166,7 +166,7 @@ const struct ext_include_script_info *ext_include_binary_script_get
 (struct ext_include_binary_context *binctx, struct sieve_script *script)
 {
 	return (struct ext_include_script_info *)
-		hash_lookup(binctx->included_scripts, script);
+		hash_table_lookup(binctx->included_scripts, script);
 }
 
 unsigned int ext_include_binary_script_get_count
@@ -309,8 +309,8 @@ static bool ext_include_binary_up_to_date(struct sieve_binary *sbin)
 	void *key, *value;
 		
 	/* Release references to all included script objects */
-	hctx = hash_iterate_init(binctx->included_scripts);
-	while ( hash_iterate(hctx, &key, &value) ) {
+	hctx = hash_table_iterate_init(binctx->included_scripts);
+	while ( hash_table_iterate(hctx, &key, &value) ) {
 		struct ext_include_script_info *incscript = (struct ext_include_script_info *) value;
 		
 		/* Is the binary newer than this dependency? */
@@ -319,7 +319,7 @@ static bool ext_include_binary_up_to_date(struct sieve_binary *sbin)
 			return FALSE;
 		}
 	}
-	hash_iterate_deinit(&hctx);
+	hash_table_iterate_deinit(&hctx);
 
 	return TRUE;
 }
@@ -332,15 +332,15 @@ static void ext_include_binary_free(struct sieve_binary *sbin)
 	void *key, *value;
 		
 	/* Release references to all included script objects */
-	hctx = hash_iterate_init(binctx->included_scripts);
-	while ( hash_iterate(hctx, &key, &value) ) {
+	hctx = hash_table_iterate_init(binctx->included_scripts);
+	while ( hash_table_iterate(hctx, &key, &value) ) {
 		struct ext_include_script_info *incscript = (struct ext_include_script_info *) value;
 		
 		sieve_script_unref(&incscript->script);
 	}
-	hash_iterate_deinit(&hctx);
+	hash_table_iterate_deinit(&hctx);
 
-	hash_destroy(&binctx->included_scripts);
+	hash_table_destroy(&binctx->included_scripts);
 
 	if ( binctx->global_vars != NULL ) 
 		sieve_variable_scope_unref(&binctx->global_vars);
@@ -377,8 +377,8 @@ bool ext_include_binary_dump(struct sieve_dumptime_env *denv)
 	if ( !ext_include_variables_dump(denv, binctx->global_vars) )
 		return FALSE;
 
-	hctx = hash_iterate_init(binctx->included_scripts);		
-	while ( hash_iterate(hctx, &key, &value) ) {
+	hctx = hash_table_iterate_init(binctx->included_scripts);		
+	while ( hash_table_iterate(hctx, &key, &value) ) {
 		struct ext_include_script_info *incscript = (struct ext_include_script_info *) value;
 
 		sieve_binary_dump_sectionf(denv, "Included %s script '%s' (block: %d)", 
@@ -405,7 +405,7 @@ bool ext_include_binary_dump(struct sieve_dumptime_env *denv)
 	if ( !sieve_binary_block_set_active(sbin, prvblk, NULL) ) 
 		return FALSE;
 	
-	hash_iterate_deinit(&hctx);
+	hash_table_iterate_deinit(&hctx);
 	
 	return TRUE;
 }
diff --git a/src/lib-sieve/plugins/variables/ext-variables-common.c b/src/lib-sieve/plugins/variables/ext-variables-common.c
index 029298591..1826fbfa4 100644
--- a/src/lib-sieve/plugins/variables/ext-variables-common.c
+++ b/src/lib-sieve/plugins/variables/ext-variables-common.c
@@ -57,7 +57,7 @@ struct sieve_variable_scope *sieve_variable_scope_create
 	scope->refcount = 1;
 
 	scope->ext = ext;
-	scope->variables = hash_create
+	scope->variables = hash_table_create
 		(default_pool, pool, 0, strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 	p_array_init(&scope->variable_index, pool, 128);
 		
@@ -76,7 +76,7 @@ void sieve_variable_scope_unref(struct sieve_variable_scope **scope)
 	if (--(*scope)->refcount != 0)
 		return;
 
-	hash_destroy(&(*scope)->variables);
+	hash_table_destroy(&(*scope)->variables);
 
 	pool_unref(&(*scope)->pool);
     *scope = NULL;
@@ -110,7 +110,7 @@ struct sieve_variable *sieve_variable_scope_declare
 	new_var->identifier = p_strdup(scope->pool, identifier);
 	new_var->index = array_count(&scope->variable_index);
 
-	hash_insert(scope->variables, (void *) new_var->identifier, (void *) new_var);
+	hash_table_insert(scope->variables, (void *) new_var->identifier, (void *) new_var);
 	array_append(&scope->variable_index, &new_var, 1);
 	
 	return new_var;
@@ -120,7 +120,7 @@ struct sieve_variable *sieve_variable_scope_get_variable
 (struct sieve_variable_scope *scope, const char *identifier, bool declare)
 {
 	struct sieve_variable *var = 
-		(struct sieve_variable *) hash_lookup(scope->variables, identifier);
+		(struct sieve_variable *) hash_table_lookup(scope->variables, identifier);
 
 	if ( var == NULL && declare ) {
 		var = sieve_variable_scope_declare(scope, identifier);
@@ -135,7 +135,7 @@ struct sieve_variable *sieve_variable_scope_import
 	struct sieve_variable *new_var = p_new(scope->pool, struct sieve_variable, 1);
 	memcpy(new_var, var, sizeof(struct sieve_variable));
 		
-	hash_insert(scope->variables, (void *) new_var->identifier, (void *) new_var);
+	hash_table_insert(scope->variables, (void *) new_var->identifier, (void *) new_var);
 	
 	/* Not entered into the index because it is an external variable 
 	 * (This can be done unlimited; only limited by the size of the external scope)
@@ -149,7 +149,7 @@ struct sieve_variable_scope_iter *sieve_variable_scope_iterate_init
 {
 	struct sieve_variable_scope_iter *iter = t_new(struct sieve_variable_scope_iter, 1);
 	iter->scope = scope;
-	iter->hctx = hash_iterate_init(scope->variables);
+	iter->hctx = hash_table_iterate_init(scope->variables);
 
 	return iter;
 }
@@ -159,7 +159,7 @@ bool sieve_variable_scope_iterate
 {
 	void *key, *value;
 
-	if ( !hash_iterate(iter->hctx, &key, &value) )
+	if ( !hash_table_iterate(iter->hctx, &key, &value) )
 		return FALSE; 
 	
 	*var_r = (struct sieve_variable *) value;
@@ -169,14 +169,14 @@ bool sieve_variable_scope_iterate
 void sieve_variable_scope_iterate_deinit
 (struct sieve_variable_scope_iter **iter)
 {
-	hash_iterate_deinit(&(*iter)->hctx);
+	hash_table_iterate_deinit(&(*iter)->hctx);
 	*iter = NULL;
 }
 
 unsigned int sieve_variable_scope_declarations
 (struct sieve_variable_scope *scope)
 {
-	return hash_count(scope->variables);
+	return hash_table_count(scope->variables);
 }
 
 unsigned int sieve_variable_scope_size
diff --git a/src/lib-sieve/sieve-extensions.c b/src/lib-sieve/sieve-extensions.c
index 5e6e85104..6d2e59138 100644
--- a/src/lib-sieve/sieve-extensions.c
+++ b/src/lib-sieve/sieve-extensions.c
@@ -160,7 +160,7 @@ static struct hash_table *extension_index;
 static void sieve_extensions_init_registry(void)
 {	
 	p_array_init(&extensions, default_pool, 4);
-	extension_index = hash_create
+	extension_index = hash_table_create
 		(default_pool, default_pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
 }
 
@@ -175,7 +175,7 @@ int sieve_extension_register(const struct sieve_extension *extension)
 	ereg->extension = extension;
 	ereg->id = ext_id;
 	
-	hash_insert(extension_index, (void *) extension->name, (void *) ereg);
+	hash_table_insert(extension_index, (void *) extension->name, (void *) ereg);
 
 	if ( extension->load != NULL && !extension->load(ext_id) ) {
 		sieve_sys_error("failed to load '%s' extension support.", extension->name);
@@ -210,7 +210,7 @@ const struct sieve_extension *sieve_extension_get_by_name(const char *name)
 		return NULL;	
 		
 	ereg = (struct sieve_extension_registration *) 
-		hash_lookup(extension_index, name);
+		hash_table_lookup(extension_index, name);
 
 	if ( ereg == NULL )
 		return NULL;
@@ -259,11 +259,11 @@ const char *sieve_extensions_get_string(void)
 static void sieve_extensions_deinit_registry(void) 
 {
 	struct hash_iterate_context *itx = 
-		hash_iterate_init(extension_index);
+		hash_table_iterate_init(extension_index);
 	void *key; 
 	void *ereg;
 	
-	while ( hash_iterate(itx, &key, &ereg) ) {
+	while ( hash_table_iterate(itx, &key, &ereg) ) {
 		const struct sieve_extension *ext = 
 			((struct sieve_extension_registration *) ereg)->extension;
 		
@@ -273,10 +273,10 @@ static void sieve_extensions_deinit_registry(void)
 		p_free(default_pool, ereg);
 	}
 
-	hash_iterate_deinit(&itx); 	
+	hash_table_iterate_deinit(&itx); 	
 
 	array_free(&extensions);
-	hash_destroy(&extension_index);
+	hash_table_destroy(&extension_index);
 }
 
 /*
@@ -287,19 +287,19 @@ static struct hash_table *capabilities_index;
 
 static void sieve_extensions_init_capabilities(void)
 {	
-	capabilities_index = hash_create
+	capabilities_index = hash_table_create
 		(default_pool, default_pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
 }
 
 static void sieve_extensions_deinit_capabilities(void) 
 {
-	hash_destroy(&capabilities_index);
+	hash_table_destroy(&capabilities_index);
 }
 
 void sieve_extension_capabilities_register
 	(const struct sieve_extension_capabilities *cap) 
 {	
-	hash_insert
+	hash_table_insert
 		(capabilities_index, (void *) cap->name, (void *) cap);
 }
 
@@ -308,7 +308,7 @@ const char *sieve_extension_capabilities_get_string
 {
   const struct sieve_extension_capabilities *cap = 
 		(const struct sieve_extension_capabilities *) 
-			hash_lookup(capabilities_index, cap_name);
+			hash_table_lookup(capabilities_index, cap_name);
 
 	if ( cap == NULL || cap->get_string == NULL )
 		return NULL;
diff --git a/src/lib-sieve/sieve-result.c b/src/lib-sieve/sieve-result.c
index ef5753822..66e0a1a92 100644
--- a/src/lib-sieve/sieve-result.c
+++ b/src/lib-sieve/sieve-result.c
@@ -116,7 +116,7 @@ void sieve_result_unref(struct sieve_result **result)
 		return;
 
 	if ( (*result)->action_contexts != NULL )
-        hash_destroy(&(*result)->action_contexts);
+        hash_table_destroy(&(*result)->action_contexts);
 
 	sieve_error_handler_unref(&(*result)->ehandler);
 
@@ -205,11 +205,11 @@ void sieve_result_add_implicit_side_effect
 	struct sieve_result_action_context *actctx = NULL;
 	
 	if ( result->action_contexts == NULL ) {
-		result->action_contexts = hash_create
+		result->action_contexts = hash_table_create
 			(default_pool, result->pool, 0, NULL, NULL);
 	} else {
 		actctx = (struct sieve_result_action_context *) 
-			hash_lookup(result->action_contexts, to_action);
+			hash_table_lookup(result->action_contexts, to_action);
 	}
 
 	if ( actctx == NULL ) {
@@ -218,7 +218,7 @@ void sieve_result_add_implicit_side_effect
 		actctx->action = to_action;
 		actctx->seffects = sieve_side_effects_list_create(result);
 		
-		hash_insert(result->action_contexts, (void *) to_action, 
+		hash_table_insert(result->action_contexts, (void *) to_action, 
 			(void *) actctx);
 	}	
 	
@@ -398,7 +398,7 @@ int sieve_result_add_action
 		
 		/* Check for implicit side effects to this particular action */
 		actctx = (struct sieve_result_action_context *) 
-				hash_lookup(result->action_contexts, action);
+				hash_table_lookup(result->action_contexts, action);
 		
 		if ( actctx != NULL ) {
 			struct sieve_result_side_effect *iseff;
@@ -551,7 +551,7 @@ static bool _sieve_result_implicit_keep
 		
 		/* Check for implicit side effects to store action */
 		actctx = (struct sieve_result_action_context *) 
-				hash_lookup(result->action_contexts, &act_store);
+				hash_table_lookup(result->action_contexts, &act_store);
 		
 		if ( actctx != NULL && actctx->seffects != NULL ) 
 			rsef_first = actctx->seffects->first_effect;
diff --git a/src/lib-sieve/sieve-validator.c b/src/lib-sieve/sieve-validator.c
index 0406373f2..71b01437b 100644
--- a/src/lib-sieve/sieve-validator.c
+++ b/src/lib-sieve/sieve-validator.c
@@ -173,7 +173,7 @@ struct sieve_validator *sieve_validator_create
 	p_array_init(&validator->extensions, pool, sieve_extensions_get_count());
 		
 	/* Setup command registry */
-	validator->commands = hash_create
+	validator->commands = hash_table_create
 		(default_pool, pool, 0, strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 	sieve_validator_register_core_commands(validator);
 	sieve_validator_register_core_tests(validator);
@@ -194,7 +194,7 @@ void sieve_validator_free(struct sieve_validator **validator)
 	const struct sieve_validator_extension_reg *extrs;
 	unsigned int ext_count, i;
 
-	hash_destroy(&(*validator)->commands);
+	hash_table_destroy(&(*validator)->commands);
 	sieve_ast_unref(&(*validator)->ast);
 
 	sieve_error_handler_unref(&(*validator)->ehandler);
@@ -286,7 +286,7 @@ sieve_validator_find_command_registration
 (struct sieve_validator *validator, const char *command) 
 {
 	return (struct sieve_command_registration *) 
-		hash_lookup(validator->commands, command);
+		hash_table_lookup(validator->commands, command);
 }
 
 static struct sieve_command_registration *_sieve_validator_register_command
@@ -296,7 +296,7 @@ static struct sieve_command_registration *_sieve_validator_register_command
 	struct sieve_command_registration *record = 
 		p_new(validator->pool, struct sieve_command_registration, 1);
 	record->command = command;
-	hash_insert(validator->commands, (void *) identifier, (void *) record);
+	hash_table_insert(validator->commands, (void *) identifier, (void *) record);
 		
 	return record;
 }
-- 
GitLab