dovecot-2.0-pigeonhole: Made action commands use new lineinfo fa...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Fri May 14 15:35:25 EEST 2010


details:   http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/131077b9da32
changeset: 1283:131077b9da32
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Fri May 14 14:02:48 2010 +0200
description:
Made action commands use new lineinfo facility.

diffstat:

 src/lib-sieve/cmd-discard.c                   |  14 ++------------
 src/lib-sieve/cmd-keep.c                      |  15 ++-------------
 src/lib-sieve/cmd-redirect.c                  |  12 +-----------
 src/lib-sieve/ext-fileinto.c                  |  14 ++------------
 src/lib-sieve/ext-reject.c                    |  12 +-----------
 src/lib-sieve/plugins/enotify/cmd-notify.c    |  12 +-----------
 src/lib-sieve/plugins/notify/cmd-denotify.c   |  14 --------------
 src/lib-sieve/plugins/notify/cmd-notify.c     |  12 +-----------
 src/lib-sieve/plugins/vacation/cmd-vacation.c |  12 +-----------
 src/lib-sieve/sieve-code.c                    |  32 --------------------------------
 src/lib-sieve/sieve-code.h                    |  12 ------------
 src/lib-sieve/sieve-interpreter.c             |  13 +++++++++++--
 src/lib-sieve/sieve-interpreter.h             |   3 +++
 13 files changed, 25 insertions(+), 152 deletions(-)

diffs (truncated from 468 to 300 lines):

diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/cmd-discard.c
--- a/src/lib-sieve/cmd-discard.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/cmd-discard.c	Fri May 14 14:02:48 2010 +0200
@@ -77,13 +77,10 @@
  */
  
 static bool cmd_discard_generate
-(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd) 
+(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd ATTR_UNUSED) 
 {
 	sieve_operation_emit(cgenv->sblock, NULL, &cmd_discard_operation);
 
-	/* Emit line number */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	return TRUE;
 }
 
@@ -97,10 +94,6 @@
 	sieve_code_dumpf(denv, "DISCARD");
 	sieve_code_descend(denv);
 
-	/* Source line */
-	if ( !sieve_code_source_line_dump(denv, address) )
-		return FALSE;
-
 	return sieve_code_dumper_print_optional_operands(denv, address);
 }
 
@@ -115,10 +108,7 @@
 	unsigned int source_line;
 	
 	/* Source line */
-	if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "failed to read source line");
-        return SIEVE_EXEC_BIN_CORRUPT;
-	}
+	source_line = sieve_runtime_get_source_location(renv, renv->oprtn.address);
 
 	sieve_runtime_trace(renv, "DISCARD action");
 
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/cmd-keep.c
--- a/src/lib-sieve/cmd-keep.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/cmd-keep.c	Fri May 14 14:02:48 2010 +0200
@@ -59,9 +59,6 @@
 	/* Emit opcode */
 	sieve_operation_emit(cgenv->sblock, NULL, &cmd_keep_operation);
 
-	/* Emit line number */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -76,10 +73,6 @@
 	sieve_code_dumpf(denv, "KEEP");
 	sieve_code_descend(denv);
 
-	/* Source line */
-	if ( !sieve_code_source_line_dump(denv, address) )
-		return FALSE;
-
 	return sieve_code_dumper_print_optional_operands(denv, address);
 }
 
@@ -88,18 +81,14 @@
  */
 
 static int cmd_keep_operation_execute
-(const struct sieve_runtime_env *renv ATTR_UNUSED, 
-	sieve_size_t *address ATTR_UNUSED)
+(const struct sieve_runtime_env *renv, sieve_size_t *address)
 {	
 	struct sieve_side_effects_list *slist = NULL;
 	unsigned int source_line;
 	int ret = 0;	
 
 	/* Source line */
-	if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "invalid source line");
-		return SIEVE_EXEC_BIN_CORRUPT;
-	}
+	source_line = sieve_runtime_get_source_location(renv, renv->oprtn.address);
 	
 	/* Optional operands (side effects only) */
 	if ( (ret=sieve_interpreter_handle_optional_operands
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/cmd-redirect.c
--- a/src/lib-sieve/cmd-redirect.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/cmd-redirect.c	Fri May 14 14:02:48 2010 +0200
@@ -162,9 +162,6 @@
 {
 	sieve_operation_emit(cgenv->sblock, NULL,  &cmd_redirect_operation);
 
-	/* Emit line number */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -179,10 +176,6 @@
 	sieve_code_dumpf(denv, "REDIRECT");
 	sieve_code_descend(denv);
 
-	/* Source line */
-    if ( !sieve_code_source_line_dump(denv, address) )
-        return FALSE;
-
 	if ( !sieve_code_dumper_print_optional_operands(denv, address) )
 		return FALSE;
 
@@ -205,10 +198,7 @@
 	int ret = 0;
 
 	/* Source line */
-    if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "invalid source line");
-        return SIEVE_EXEC_BIN_CORRUPT;
-	}
+	source_line = sieve_runtime_get_source_location(renv, renv->oprtn.address);
 
 	/* Optional operands (side effects) */
 	if ( (ret=sieve_interpreter_handle_optional_operands
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/ext-fileinto.c
--- a/src/lib-sieve/ext-fileinto.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/ext-fileinto.c	Fri May 14 14:02:48 2010 +0200
@@ -125,9 +125,6 @@
 {
 	sieve_operation_emit(cgenv->sblock, cmd->ext, &fileinto_operation);
 
-	/* Emit line number */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -142,10 +139,6 @@
 	sieve_code_dumpf(denv, "FILEINTO");
 	sieve_code_descend(denv);
 
-	/* Source line */
-	if ( !sieve_code_source_line_dump(denv, address) )
-		return FALSE;
-
 	if ( !sieve_code_dumper_print_optional_operands(denv, address) ) {
 		return FALSE;
 	}
@@ -163,7 +156,7 @@
 	struct sieve_side_effects_list *slist = NULL; 
 	string_t *folder;
 	const char *mailbox;
-	unsigned int source_line;
+	unsigned int source_line; 
 	int ret = 0;
 	
 	/*
@@ -171,10 +164,7 @@
 	 */
 
 	/* Source line */
-	if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "invalid source line");
-		return SIEVE_EXEC_BIN_CORRUPT;
-	}
+	source_line = sieve_runtime_get_source_location(renv, renv->oprtn.address);
 	
 	/* Optional operands */
 	if ( (ret=sieve_interpreter_handle_optional_operands(renv, address, &slist)) 
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/ext-reject.c
--- a/src/lib-sieve/ext-reject.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/ext-reject.c	Fri May 14 14:02:48 2010 +0200
@@ -235,9 +235,6 @@
 	else
 		sieve_operation_emit(cgenv->sblock, cmd->ext, &ereject_operation);
 
-	/* Emit line number */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -253,10 +250,6 @@
 
 	sieve_code_dumpf(denv, "%s", sieve_operation_mnemonic(op));
 	sieve_code_descend(denv);
-	
-	/* Source line */
-	if ( !sieve_code_source_line_dump(denv, address) )
-		return FALSE;
 
 	if ( !sieve_code_dumper_print_optional_operands(denv, address) )
 		return FALSE;
@@ -281,10 +274,7 @@
 	int ret;
 
 	/* Source line */
-	if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "invalid source line");
-		return SIEVE_EXEC_BIN_CORRUPT;
-	}
+	source_line = sieve_runtime_get_source_location(renv, op->address);
 	
 	/* Optional operands (side effects) */
 	if ( (ret=sieve_interpreter_handle_optional_operands
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/plugins/enotify/cmd-notify.c
--- a/src/lib-sieve/plugins/enotify/cmd-notify.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/plugins/enotify/cmd-notify.c	Fri May 14 14:02:48 2010 +0200
@@ -336,9 +336,6 @@
 {		 
 	sieve_operation_emit(cgenv->sblock, cmd->ext, &notify_operation);
 
-	/* Emit source line */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -355,10 +352,6 @@
 	sieve_code_dumpf(denv, "NOTIFY");
 	sieve_code_descend(denv);	
 
-	/* Source line */
-	if ( !sieve_code_source_line_dump(denv, address) )
-		return FALSE;
-
 	/* Dump optional operands */
 	if ( sieve_operand_optional_present(denv->sblock, address) ) {
 		while ( opt_code != 0 ) {
@@ -421,10 +414,7 @@
 	 */
 		
 	/* Source line */
-	if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "invalid source line");
-		return SIEVE_EXEC_BIN_CORRUPT;
-	}
+	source_line = sieve_runtime_get_source_location(renv, renv->oprtn.address);
 	
 	/* Optional operands */	
 	if ( sieve_operand_optional_present(renv->sblock, address) ) {
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/plugins/notify/cmd-denotify.c
--- a/src/lib-sieve/plugins/notify/cmd-denotify.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/plugins/notify/cmd-denotify.c	Fri May 14 14:02:48 2010 +0200
@@ -220,9 +220,6 @@
 {
 	sieve_operation_emit(cgenv->sblock, cmd->ext, &denotify_operation);
 
-	/* Emit source line */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -240,10 +237,6 @@
 	sieve_code_dumpf(denv, "%s", sieve_operation_mnemonic(op));
 	sieve_code_descend(denv);	
 
-	/* Source line */
-	if ( !sieve_code_source_line_dump(denv, address) )
-		return FALSE;
-
 	/* Dump optional operands */
 	if ( sieve_operand_optional_present(denv->sblock, address) ) {
 		while ( opt_code != 0 ) {
@@ -294,18 +287,11 @@
 	struct sieve_match_context *mctx;
 	struct sieve_result_iterate_context *rictx;
 	const struct sieve_action *action;
-	unsigned int source_line;
 	int ret;
 
 	/*
 	 * Read operands
 	 */
-		
-	/* Source line */
-	if ( !sieve_code_source_line_read(renv, address, &source_line) ) {
-		sieve_runtime_trace_error(renv, "invalid source line");
-		return SIEVE_EXEC_BIN_CORRUPT;
-	}
 	
 	/* Optional operands */	
 	if ( sieve_operand_optional_present(renv->sblock, address) ) {
diff -r c932b2d80dd8 -r 131077b9da32 src/lib-sieve/plugins/notify/cmd-notify.c
--- a/src/lib-sieve/plugins/notify/cmd-notify.c	Fri May 14 13:08:14 2010 +0200
+++ b/src/lib-sieve/plugins/notify/cmd-notify.c	Fri May 14 14:02:48 2010 +0200
@@ -355,9 +355,6 @@
 {
 	sieve_operation_emit(cgenv->sblock, cmd->ext, &notify_old_operation);
 
-	/* Emit source line */
-	sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
-
 	/* Generate arguments */
 	return sieve_generate_arguments(cgenv, cmd, NULL);
 }
@@ -374,10 +371,6 @@
 	sieve_code_dumpf(denv, "NOTIFY");
 	sieve_code_descend(denv);	
 
-	/* Source line */


More information about the dovecot-cvs mailing list