From 5b3741a896469e69a52c74dc021f44c940e38df9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 14 Nov 2006 12:11:48 +0000 Subject: [PATCH] Avoid abort. EXTRA_CHECK defined and annotated --- bfile/cfile.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bfile/cfile.c b/bfile/cfile.c index 4774072..a0dfaa2 100644 --- a/bfile/cfile.c +++ b/bfile/cfile.c @@ -1,4 +1,4 @@ -/* $Id: cfile.c,v 1.39 2006-11-14 08:12:06 adam Exp $ +/* $Id: cfile.c,v 1.40 2006-11-14 12:11:48 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -29,6 +29,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "mfile.h" #include "cfile.h" +/* set to 1 if extra commit/shadow check is to be performed */ +#define EXTRA_CHECK 0 + static int write_head(CFile cf) { int left = cf->head.hash_size * sizeof(zint); @@ -343,20 +346,19 @@ static int cf_lookup_hash(CFile cf, zint no, zint *vno) } if (hb) continue; -#if 0 - /* extra check ... */ +#if EXTRA_CHECK for (hb = cf->bucket_lru_back; hb; hb = hb->lru_next) { if (hb->ph.this_bucket == block_no) { yaz_log(YLOG_FATAL, "Found hash bucket on other chain(1)"); - abort(); + return -1; } for (i = 0; iph.vno[i]; i++) if (hb->ph.no[i] == no) { yaz_log(YLOG_FATAL, "Found hash bucket on other chain (2)"); - abort(); + return -1; } } #endif @@ -476,14 +478,13 @@ static zint cf_new_hash(CFile cf, zint no) if (hb) continue; -#if 0 - /* extra check ... */ +#if EXTRA_CHECK for (hb = cf->bucket_lru_back; hb; hb = hb->lru_next) { if (hb->ph.this_bucket == *bucketpp) { yaz_log(YLOG_FATAL, "Found hash bucket on other chain"); - abort(); + return 0; } } #endif -- 1.7.10.4