aboutsummaryrefslogtreecommitdiffstats
path: root/libibex/wordindexmem.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-08-10 09:19:47 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-08-10 09:19:47 +0800
commited70b7f1412307294fd33e35aa981a37363c15e0 (patch)
tree918bd5948dea2c4c348ae0de3b932fb0a3054f66 /libibex/wordindexmem.c
parentd471640fe82b68d5430514120dffa69be196f852 (diff)
downloadgsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar
gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.gz
gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.bz2
gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.lz
gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.xz
gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.tar.zst
gsoc2013-evolution-ed70b7f1412307294fd33e35aa981a37363c15e0.zip
NOOP if writing to a failed file. (word_index_pre): NOOP if failed file.
2001-08-10 Not Zed <NotZed@Ximian.com> * wordindexmem.c (sync_cache_entry): NOOP if writing to a failed file. (word_index_pre): NOOP if failed file. (ibex_create_word_index_mem): Setup blocks value. ** Added internal exception handling to libibex, in the case of errors with on-disk data, exceptions are returned. * block.c (ibex_block_cache_open): Detect fatal errors below us and clean up appropriately. (ibex_block_cache_fail): New function to handle the failure, and keep track of it. (ibex_block_cache_sync): Dont do anything if we've failed on this file. * disktail.c (tail_compress): Add blocks param so we can assert for exceptions. * hash.c, block.c disktail.c: g_assert->ibex_block_cache_assert where dealing with external data. * hash.c (hash_info): Add index param so we can assert for exceptions. * ibex_block.c (ibex_index_buffer): Setjmp before calling into internal routines. (ibex_save): " (ibex_unindex): " (ibex_find): " (ibex_find_name): " (ibex_contains_name): " (ibex_reset): Function to reset the index file if we have an error, call when we have an error. * block.h (ibex_block_cache_assert): Create assertion/exception macros, and include a setjmp buffer for returning it. 2001-08-09 Not Zed <NotZed@Ximian.com> * Makefile.am (libibex_la_SOURCES): Remove wordindex.c, wordindexmem is what's used. svn path=/trunk/; revision=11864
Diffstat (limited to 'libibex/wordindexmem.c')
-rw-r--r--libibex/wordindexmem.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libibex/wordindexmem.c b/libibex/wordindexmem.c
index 55d2f5ef40..077b53e051 100644
--- a/libibex/wordindexmem.c
+++ b/libibex/wordindexmem.c
@@ -134,6 +134,7 @@ ibex_create_word_index_mem(struct _memcache *bc, blockid_t *wordroot, blockid_t
struct _IBEXWord *idx;
idx = g_malloc0(sizeof(*idx));
+ idx->blocks = bc;
idx->wordcache = g_hash_table_new(g_str_hash, g_str_equal);
ibex_list_new(&idx->wordnodes);
idx->wordcount = 0;
@@ -201,6 +202,12 @@ static void word_index_pre(struct _IBEXWord *idx)
if (idx->precount > 1)
return;
+ /* NOOP if failed */
+ if (idx->blocks->failed) {
+ g_warning("word_index_pre() on failed data file");
+ return;
+ }
+
/* want to load all words into the cache lookup table */
d(printf("pre-loading all word info into memory\n"));
idc = idx->wordindex->klass->get_cursor(idx->wordindex);
@@ -479,6 +486,10 @@ sync_cache_entry(struct _IBEXWord *idx, struct _wordcache *cache)
{
GArray array; /* just use this as a header */
blockid_t oldblock, oldtail;
+
+ /* NOOP if failed */
+ if (idx->blocks->failed)
+ return;
if (cache->filecount == 0)
return;