dovecot-2.2-pigeonhole: lib-sieve: include extension: Fixed prob...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Mon May 12 18:40:48 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/5b41f1bca5ca
changeset: 1858:5b41f1bca5ca
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Mon May 12 20:22:30 2014 +0200
description:
lib-sieve: include extension: Fixed problem with handling of duplicate includes.
Flags weren't actually updated.

diffstat:

 src/lib-sieve/plugins/include/ext-include-binary.c |  13 ++++---------
 src/lib-sieve/plugins/include/ext-include-binary.h |   7 +++----
 src/lib-sieve/plugins/include/ext-include-common.c |   9 +++++----
 3 files changed, 12 insertions(+), 17 deletions(-)

diffs (83 lines):

diff -r 9f8a3411090a -r 5b41f1bca5ca src/lib-sieve/plugins/include/ext-include-binary.c
--- a/src/lib-sieve/plugins/include/ext-include-binary.c	Fri May 09 08:55:02 2014 +0200
+++ b/src/lib-sieve/plugins/include/ext-include-binary.c	Mon May 12 20:22:30 2014 +0200
@@ -124,7 +124,7 @@
  * Script inclusion
  */
 
-const struct ext_include_script_info *ext_include_binary_script_include
+struct ext_include_script_info *ext_include_binary_script_include
 (struct ext_include_binary_context *binctx, 
 	enum ext_include_script_location location, enum ext_include_flags flags,
 	struct sieve_script *script,	struct sieve_binary_block *inc_block)
@@ -148,18 +148,13 @@
 	return incscript;
 }
 
-bool ext_include_binary_script_is_included
-(struct ext_include_binary_context *binctx, struct sieve_script *script,
-	const struct ext_include_script_info **script_info_r)
+struct ext_include_script_info *ext_include_binary_script_get_include_info
+(struct ext_include_binary_context *binctx, struct sieve_script *script)
 {
 	struct ext_include_script_info *incscript =
 		hash_table_lookup(binctx->included_scripts, script);
 
-	if ( incscript == NULL )
-		return FALSE;
-
-	*script_info_r = incscript;
-	return TRUE;
+	return incscript;
 }
 
 const struct ext_include_script_info *ext_include_binary_script_get_included
diff -r 9f8a3411090a -r 5b41f1bca5ca src/lib-sieve/plugins/include/ext-include-binary.h
--- a/src/lib-sieve/plugins/include/ext-include-binary.h	Fri May 09 08:55:02 2014 +0200
+++ b/src/lib-sieve/plugins/include/ext-include-binary.h	Mon May 12 20:22:30 2014 +0200
@@ -39,13 +39,12 @@
 	struct sieve_binary_block *block;
 };
 
-const struct ext_include_script_info *ext_include_binary_script_include
+struct ext_include_script_info *ext_include_binary_script_include
 	(struct ext_include_binary_context *binctx, 
 		enum ext_include_script_location location, enum ext_include_flags flags,
 		struct sieve_script *script, struct sieve_binary_block *inc_block);
-bool ext_include_binary_script_is_included
-	(struct ext_include_binary_context *binctx, struct sieve_script *script,
-		const struct ext_include_script_info **script_info_r);
+struct ext_include_script_info *ext_include_binary_script_get_include_info
+	(struct ext_include_binary_context *binctx, struct sieve_script *script);
 
 const struct ext_include_script_info *ext_include_binary_script_get_included
 	(struct ext_include_binary_context *binctx, unsigned int include_id);
diff -r 9f8a3411090a -r 5b41f1bca5ca src/lib-sieve/plugins/include/ext-include-common.c
--- a/src/lib-sieve/plugins/include/ext-include-common.c	Fri May 09 08:55:02 2014 +0200
+++ b/src/lib-sieve/plugins/include/ext-include-common.c	Mon May 12 20:22:30 2014 +0200
@@ -471,7 +471,7 @@
 		ext_include_get_generator_context(this_ext, gentr);
 	struct ext_include_generator_context *pctx;
 	struct sieve_error_handler *ehandler = sieve_generator_error_handler(gentr);
-	const struct ext_include_script_info *included;
+	struct ext_include_script_info *included;
 
 	*included_r = NULL;
 
@@ -516,12 +516,13 @@
 	binctx = ext_include_binary_init(this_ext, sbin, cgenv->ast);
 
 	/* Is the script already compiled into the current binary? */
-	if ( ext_include_binary_script_is_included(binctx, script, &included) ) {
+	included = ext_include_binary_script_get_include_info(binctx, script);
+	if ( included != NULL ) {
 		/* Yes, only update flags */
 		if ( (flags & EXT_INCLUDE_FLAG_OPTIONAL) == 0 )
-			flags &= ~EXT_INCLUDE_FLAG_OPTIONAL;
+			included->flags &= ~EXT_INCLUDE_FLAG_OPTIONAL;
 		if ( (flags & EXT_INCLUDE_FLAG_ONCE) == 0 )
-			flags &= ~EXT_INCLUDE_FLAG_ONCE;
+			included->flags &= ~EXT_INCLUDE_FLAG_ONCE;
 	} else 	{
 		const char *script_name = sieve_script_name(script);
 		enum sieve_compile_flags cpflags = cgenv->flags;


More information about the dovecot-cvs mailing list