dovecot-2.2: lib-fts: Store pointers to fts_filter classes inste...

dovecot at dovecot.org dovecot at dovecot.org
Sat May 9 11:54:07 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/307fe289f1b7
changeset: 18586:307fe289f1b7
user:      Timo Sirainen <tss at iki.fi>
date:      Sat May 09 14:49:20 2015 +0300
description:
lib-fts: Store pointers to fts_filter classes instead of copying the data.
Doesn't really matter, but it's a bit cleaner when fts_filter_find() returns
the same pointer as the fts_filter class originally was.

diffstat:

 src/lib-fts/fts-filter.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r fcc20dce3c83 -r 307fe289f1b7 src/lib-fts/fts-filter.c
--- a/src/lib-fts/fts-filter.c	Sat May 09 14:41:05 2015 +0300
+++ b/src/lib-fts/fts-filter.c	Sat May 09 14:49:20 2015 +0300
@@ -6,7 +6,7 @@
 #include "fts-filter.h"
 #include "fts-filter-private.h"
 
-ARRAY(struct fts_filter) fts_filter_classes;
+static ARRAY(const struct fts_filter *) fts_filter_classes;
 
 void fts_filters_init(void)
 {
@@ -27,16 +27,16 @@
 {
 	i_assert(fts_filter_find(filter_class->class_name) == NULL);
 
-	array_append(&fts_filter_classes, filter_class, 1);
+	array_append(&fts_filter_classes, &filter_class, 1);
 }
 
 const struct fts_filter *fts_filter_find(const char *name)
 {
-	const struct fts_filter *fp = NULL;
+	const struct fts_filter *const *fp = NULL;
 
 	array_foreach(&fts_filter_classes, fp) {
-		if (strcmp(fp->class_name, name) == 0)
-			return fp;
+		if (strcmp((*fp)->class_name, name) == 0)
+			return *fp;
 	}
 	return NULL;
 }


More information about the dovecot-cvs mailing list