aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-filter-index.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-03-25 20:11:44 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-03-25 20:11:44 +0800
commitc6fc4e27a953c5213cff8400ec8e40f6f051e914 (patch)
tree7237e42f705cd584d36f3a2a4795a1bb16741dd3 /camel/camel-mime-filter-index.c
parentede63cde5882af8696c22ed546506ad877b73011 (diff)
downloadgsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.gz
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.bz2
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.lz
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.xz
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.zst
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.zip
When we add a new name, up all of the cache limits, because we're probably
2002-03-25 Not Zed <NotZed@Ximian.com> * camel-text-index.c (text_index_add_name): When we add a new name, up all of the cache limits, because we're probably going to be adding more. (text_index_sync): Drop the cache limits back down again, we dont need them when looking words up. ** MERGE camel_index branch. * camel-text-index.[ch]: Added files i forgot to add (eep nearly lost all this work!) * camel-block-file.c (sync_nolock): Fix an infinite loop in syncing. svn path=/trunk/; revision=16242
Diffstat (limited to 'camel/camel-mime-filter-index.c')
-rw-r--r--camel/camel-mime-filter-index.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/camel/camel-mime-filter-index.c b/camel/camel-mime-filter-index.c
index 5332bd4df2..e9df08072b 100644
--- a/camel/camel-mime-filter-index.c
+++ b/camel/camel-mime-filter-index.c
@@ -20,6 +20,7 @@
#include "camel-mime-filter-index.h"
+#include "camel-text-index.h"
static void camel_mime_filter_index_class_init (CamelMimeFilterIndexClass *klass);
static void camel_mime_filter_index_finalize (CamelObject *o);
@@ -49,8 +50,9 @@ camel_mime_filter_index_finalize(CamelObject *o)
{
CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)o;
- g_free(f->name);
- f->index = NULL; /* ibex's need refcounting? */
+ if (f->name)
+ camel_object_unref((CamelObject *)f->name);
+ camel_object_unref((CamelObject *)f->index);
}
static void
@@ -62,7 +64,8 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
goto donothing;
}
- ibex_index_buffer(f->index, f->name, in, len, NULL);
+ camel_index_name_add_buffer(f->name, in, len);
+ camel_index_name_add_buffer(f->name, NULL, 0);
donothing:
*out = in;
@@ -74,22 +77,12 @@ static void
filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace)
{
CamelMimeFilterIndex *f = (CamelMimeFilterIndex *)mf;
- int inleft = 0;
if (f->index == NULL || f->name==NULL) {
goto donothing;
}
- ibex_index_buffer(f->index, f->name, in, len, &inleft);
-
- if (inleft>0) {
- camel_mime_filter_backup(mf, in+(len-inleft), inleft);
- }
-
- *out = in;
- *outlenptr = len-inleft;
- *outprespace = prespace;
- return;
+ camel_index_name_add_buffer(f->name, in, len);
donothing:
*out = in;
@@ -123,25 +116,29 @@ camel_mime_filter_index_new (void)
return new;
}
-CamelMimeFilterIndex *camel_mime_filter_index_new_ibex (ibex *index)
+CamelMimeFilterIndex *camel_mime_filter_index_new_index (struct _CamelIndex *index)
{
CamelMimeFilterIndex *new = camel_mime_filter_index_new();
if (new) {
new->index = index;
- new->name = g_strdup("");
+ if (index)
+ camel_object_ref((CamelObject *)index);
}
return new;
}
/* Set the match name for any indexed words */
-void camel_mime_filter_index_set_name (CamelMimeFilterIndex *mf, char *name)
+void camel_mime_filter_index_set_name (CamelMimeFilterIndex *mf, struct _CamelIndexName *name)
{
- g_free(mf->name);
- mf->name = g_strdup(name);
+ if (mf->name)
+ camel_object_unref((CamelObject *)mf->name);
+ mf->name = name;
+ if (name)
+ camel_object_ref((CamelObject *)name);
}
-void camel_mime_filter_index_set_ibex (CamelMimeFilterIndex *mf, ibex *index)
+void camel_mime_filter_index_set_index (CamelMimeFilterIndex *mf, CamelIndex *index)
{
if (mf->index) {
char *out;
@@ -149,7 +146,10 @@ void camel_mime_filter_index_set_ibex (CamelMimeFilterIndex *mf, ibex *index)
camel_mime_filter_complete((CamelMimeFilter *)mf, "", 0, 0, &out, &outlen, &outspace);
}
+
mf->index = index;
+ if (index)
+ camel_object_ref((CamelObject *)index);
}