summaryrefslogtreecommitdiff
path: root/camel/camel-text-index.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-27 08:15:09 -0400
committerMatthew Barnes <mbarnes@redhat.com>2009-05-27 08:15:09 -0400
commitf47a736ca355cbaadb3276e7f9519151f57a2758 (patch)
treed0d02a2cdbfa32486e82da55e4d17a57612d9fda /camel/camel-text-index.c
parent9e2e454642b4e12a8a225260ddcdedb15fc8e2fe (diff)
downloadevolution-data-server-f47a736ca355cbaadb3276e7f9519151f57a2758.tar.gz
Remove trailing whitespace, again.
Diffstat (limited to 'camel/camel-text-index.c')
-rw-r--r--camel/camel-text-index.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 246b9ea41..b1034c37f 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -47,7 +47,7 @@
#define w(x)
-#define io(x)
+#define io(x)
#define d(x) /*(printf("%s(%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__),(x))*/
/* cursor debug */
@@ -204,7 +204,7 @@ text_index_add_name_to_word(CamelIndex *idx, const char *word, camel_key_t namei
return;
}
}
-
+
w = g_malloc0(sizeof(*w));
w->word = g_strdup(word);
w->wordid = wordid;
@@ -297,7 +297,7 @@ text_index_sync(CamelIndex *idx)
g_hash_table_remove(p->words, ww->word);
g_free(ww->word);
g_free(ww);
- }
+ }
if (camel_key_table_sync(p->word_index) == -1
|| camel_key_table_sync(p->name_index) == -1
@@ -464,7 +464,7 @@ text_index_compress_nosync(CamelIndex *idx)
}
g_free(records);
}
-
+
if (newcount > 0) {
if (camel_key_file_write(newp->links, &newdata, newcount, newrecords) == -1)
goto fail;
@@ -481,7 +481,7 @@ text_index_compress_nosync(CamelIndex *idx)
}
camel_block_file_touch_block(newp->blocks, newp->blocks->root_block);
-
+
if (camel_index_sync((CamelIndex *)newidx) == -1)
goto fail;
@@ -608,7 +608,7 @@ text_index_add_name(CamelIndex *idx, const char *name)
camel_key_table_set_flags(p->name_index, keyid, 1, 1);
camel_partition_table_remove(p->name_hash, name);
}
-
+
keyid = camel_key_table_add(p->name_index, name, 0, 0);
if (keyid != 0) {
camel_partition_table_add(p->name_hash, name, keyid);
@@ -645,9 +645,9 @@ text_index_write_name(CamelIndex *idx, CamelIndexName *idn)
/* see text_index_add_name for when this can be 0 */
if (((CamelTextIndexName *)idn)->priv->nameid != 0) {
CAMEL_TEXT_INDEX_LOCK(idx, lock);
-
+
g_hash_table_foreach(idn->words, (GHFunc)hash_write_word, idn);
-
+
CAMEL_TEXT_INDEX_UNLOCK(idx, lock);
}
@@ -763,7 +763,7 @@ camel_text_index_init(CamelTextIndex *idx)
/* this cache size and the block cache size have been tuned for about the best
with moderate memory usage. Doubling the memory usage barely affects performance. */
p->word_cache_limit = 4096; /* 1024 = 128K */
-
+
g_static_rec_mutex_init(&p->lock);
}
@@ -792,9 +792,9 @@ camel_text_index_finalise(CamelTextIndex *idx)
camel_object_unref((CamelObject *)p->blocks);
if (p->links)
camel_object_unref((CamelObject *)p->links);
-
+
g_static_rec_mutex_free(&p->lock);
-
+
g_free(p);
}
@@ -802,7 +802,7 @@ CamelType
camel_text_index_get_type(void)
{
static CamelType type = CAMEL_INVALID_TYPE;
-
+
if (type == CAMEL_INVALID_TYPE) {
type = camel_type_register(camel_index_get_type(), "CamelTextIndex",
sizeof (CamelTextIndex),
@@ -812,7 +812,7 @@ camel_text_index_get_type(void)
(CamelObjectInitFunc) camel_text_index_init,
(CamelObjectFinalizeFunc) camel_text_index_finalise);
}
-
+
return type;
}
@@ -859,7 +859,7 @@ camel_text_index_new(const char *path, int flags)
rb->word_index_root = bl->id;
camel_block_file_unref_block(p->blocks, bl);
camel_block_file_touch_block(p->blocks, p->blocks->root_block);
- }
+ }
if (rb->word_hash_root == 0) {
bl = camel_block_file_new_block(p->blocks);
@@ -870,7 +870,7 @@ camel_text_index_new(const char *path, int flags)
rb->word_hash_root = bl->id;
camel_block_file_unref_block(p->blocks, bl);
camel_block_file_touch_block(p->blocks, p->blocks->root_block);
- }
+ }
if (rb->name_index_root == 0) {
bl = camel_block_file_new_block(p->blocks);
@@ -881,7 +881,7 @@ camel_text_index_new(const char *path, int flags)
rb->name_index_root = bl->id;
camel_block_file_unref_block(p->blocks, bl);
camel_block_file_touch_block(p->blocks, p->blocks->root_block);
- }
+ }
if (rb->name_hash_root == 0) {
bl = camel_block_file_new_block(p->blocks);
@@ -892,7 +892,7 @@ camel_text_index_new(const char *path, int flags)
rb->name_hash_root = bl->id;
camel_block_file_unref_block(p->blocks, bl);
camel_block_file_touch_block(p->blocks, p->blocks->root_block);
- }
+ }
p->word_index = camel_key_table_new(p->blocks, rb->word_index_root);
p->word_hash = camel_partition_table_new(p->blocks, rb->word_hash_root);
@@ -1228,7 +1228,7 @@ camel_text_index_dump(CamelTextIndex *idx)
CamelIndexCursor *idc;
printf("Word: '%s':\n", word);
-
+
idc = camel_index_find((CamelIndex *)idx, word);
while ( (name = camel_index_cursor_next(idc)) ) {
printf(" %s", name);
@@ -1494,7 +1494,7 @@ text_index_name_add_buffer(CamelIndexName *idn, const char *buffer, size_t len)
text_index_name_add_word(idn, p->buffer->str);
/*camel_index_name_add_word(idn, p->buffer->str);*/
}
-
+
g_string_truncate (p->buffer, 0);
}
}
@@ -1529,7 +1529,7 @@ static void
camel_text_index_name_finalise(CamelTextIndexName *idn)
{
CamelTextIndexNamePrivate *p = CIN_PRIVATE(idn);
-
+
g_hash_table_destroy(idn->parent.words);
g_string_free(p->buffer, TRUE);
@@ -1542,7 +1542,7 @@ CamelType
camel_text_index_name_get_type(void)
{
static CamelType type = CAMEL_INVALID_TYPE;
-
+
if (type == CAMEL_INVALID_TYPE) {
type = camel_type_register(camel_index_name_get_type(), "CamelTextIndexName",
sizeof (CamelTextIndexName),
@@ -1552,7 +1552,7 @@ camel_text_index_name_get_type(void)
(CamelObjectInitFunc) camel_text_index_name_init,
(CamelObjectFinalizeFunc) camel_text_index_name_finalise);
}
-
+
return type;
}
@@ -1606,7 +1606,7 @@ text_index_cursor_next(CamelIndexCursor *idc)
if (flags & 1) {
g_free(p->current);
p->current = NULL;
- }
+ }
p->record_index++;
} while (p->current == NULL);
@@ -1658,7 +1658,7 @@ CamelType
camel_text_index_cursor_get_type(void)
{
static CamelType type = CAMEL_INVALID_TYPE;
-
+
if (type == CAMEL_INVALID_TYPE) {
type = camel_type_register(camel_index_cursor_get_type(), "CamelTextIndexCursor",
sizeof (CamelTextIndexCursor),
@@ -1668,7 +1668,7 @@ camel_text_index_cursor_get_type(void)
(CamelObjectInitFunc) camel_text_index_cursor_init,
(CamelObjectFinalizeFunc) camel_text_index_cursor_finalise);
}
-
+
return type;
}
@@ -1770,7 +1770,7 @@ CamelType
camel_text_index_key_cursor_get_type(void)
{
static CamelType type = CAMEL_INVALID_TYPE;
-
+
if (type == CAMEL_INVALID_TYPE) {
type = camel_type_register(camel_index_cursor_get_type(), "CamelTextIndexKeyCursor",
sizeof (CamelTextIndexKeyCursor),
@@ -1780,7 +1780,7 @@ camel_text_index_key_cursor_get_type(void)
(CamelObjectInitFunc) camel_text_index_key_cursor_init,
(CamelObjectFinalizeFunc) camel_text_index_key_cursor_finalise);
}
-
+
return type;
}
@@ -1911,7 +1911,7 @@ int main(int argc, char **argv)
line[strlen(line)-1] = 0;
/* see if its already there */
- keyid = camel_partition_table_lookup(cpi, line);
+ keyid = camel_partition_table_lookup(cpi, line);
if (keyid == 0) {
m(printf("Adding word '%s' %d\n", line, index));
@@ -1921,7 +1921,7 @@ int main(int argc, char **argv)
camel_partition_table_add(cpi, line, keyid);
m(printf("Lookup word '%s'\n", line));
- keyid = camel_partition_table_lookup(cpi, line);
+ keyid = camel_partition_table_lookup(cpi, line);
m(printf(" key = %08x\n", keyid));
}
@@ -1945,7 +1945,7 @@ int main(int argc, char **argv)
while (fgets(line, sizeof(line), fp) != NULL) {
line[strlen(line)-1] = 0;
m(printf("Lookup word '%s' %d\n", line, index));
- keyid = camel_partition_table_lookup(cpi, line);
+ keyid = camel_partition_table_lookup(cpi, line);
m(printf(" key = %08d\n", keyid));
m(printf("Lookup key %08x\n", keyid));