X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=bfile%2Fcfile.c;h=f0bcccb671760f7470f2d8e88527a4b5da372aa9;hp=ab6efb920f2a9cfcdb40db36ea912bc0776129bf;hb=a66b7d79383ae700f3358731eecfe2aafed0e90d;hpb=97a7adeb9e5059463f039495cc01cfa448463a27 diff --git a/bfile/cfile.c b/bfile/cfile.c index ab6efb9..f0bcccb 100644 --- a/bfile/cfile.c +++ b/bfile/cfile.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1995-2008 Index Data + Copyright (C) 1994-2010 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -26,7 +26,7 @@ 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 */ +/** \brief set to 1 if extra commit/shadow check is to be performed */ #define EXTRA_CHECK 0 static int write_head(CFile cf) @@ -131,7 +131,7 @@ CFile cf_open(MFile mf, MFile_area area, const char *fname, if (ret == 0 || !cf->head.state) { *firstp = 1; - cf->head.state = 1; + cf->head.state = CFILE_STATE_HASH; cf->head.block_size = block_size; cf->head.hash_size = 199; hash_bytes = cf->head.hash_size * sizeof(zint); @@ -163,7 +163,7 @@ CFile cf_open(MFile mf, MFile_area area, const char *fname, hash_bytes = cf->head.hash_size * sizeof(zint); assert(cf->head.next_bucket > 0); assert(cf->head.next_block > 0); - if (cf->head.state == 1) + if (cf->head.state == CFILE_STATE_HASH) cf->array = (zint *) xmalloc(hash_bytes); else cf->array = NULL; @@ -173,7 +173,7 @@ CFile cf_open(MFile mf, MFile_area area, const char *fname, return 0; } } - if (cf->head.state == 1) + if (cf->head.state == CFILE_STATE_HASH) { cf->parray = (struct CFile_hash_bucket **) xmalloc(cf->head.hash_size * sizeof(*cf->parray)); @@ -395,7 +395,7 @@ static int cf_moveto_flat(CFile cf) ZINT_FORMAT, cf->no_hits, cf->no_miss, cf->bucket_in_memory, cf->head.next_bucket - cf->head.first_bucket); - assert(cf->head.state == 1); + assert(cf->head.state == CFILE_STATE_HASH); if (flush_bucket(cf, -1)) return -1; assert(cf->bucket_in_memory == 0); @@ -422,7 +422,7 @@ static int cf_moveto_flat(CFile cf) cf->array = NULL; xfree(cf->parray); cf->parray = NULL; - cf->head.state = 2; + cf->head.state = CFILE_STATE_FLAT; cf->dirty = 1; return 0; } @@ -642,6 +642,7 @@ int cf_close(CFile cf) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab