aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libibex/ChangeLog13
-rw-r--r--libibex/block.c12
-rw-r--r--libibex/ibex_block.c4
-rw-r--r--libibex/index.h2
-rw-r--r--libibex/wordindexmem.c17
5 files changed, 31 insertions, 17 deletions
diff --git a/libibex/ChangeLog b/libibex/ChangeLog
index 1d74b73898..fa7e3dc48a 100644
--- a/libibex/ChangeLog
+++ b/libibex/ChangeLog
@@ -1,3 +1,16 @@
+2000-11-28 Not Zed <NotZed@HelixCode.com>
+
+ * index.h: Turn off index stats by default.
+
+ * ibex_block.c (ibex_save): And here.
+ (ibex_close): Debug out printfs.
+
+ * wordindexmem.c (ibex_create_word_index_mem): And here.
+ (num): Made buf static.
+
+ * block.c (ibex_block_cache_open): Debug out some printfs.
+ (ibex_block_read): And here.
+
2000-11-17 Not Zed <NotZed@HelixCode.com>
* wordindexmem.c (add_list): If we have the namecache active, and
diff --git a/libibex/block.c b/libibex/block.c
index 3f637d4422..b9057bc109 100644
--- a/libibex/block.c
+++ b/libibex/block.c
@@ -420,7 +420,7 @@ ibex_block_read(struct _memcache *block_cache, blockid_t blockid)
if (old->flags & BLOCK_DIRTY) {
/* are we about to un-sync the file? update root and sync it */
if (block_cache->root.flags & IBEX_ROOT_SYNCF) {
- printf("Unsyncing root block\n");
+ d(printf("Unsyncing root block\n"));
block_cache->root.flags &= ~IBEX_ROOT_SYNCF;
if (ibex_block_sync_root(block_cache) != 0) {
@@ -480,7 +480,7 @@ ibex_block_cache_open(const char *name, int flags, int mode)
if (block_cache->root.roof == 0
|| memcmp(block_cache->root.version, IBEX_VERSION, 4)
|| ((block_cache->root.flags & IBEX_ROOT_SYNCF) == 0)) {
- (printf("Initialising superblock\n"));
+ d(printf("Initialising superblock\n"));
/* reset root data */
memcpy(block_cache->root.version, IBEX_VERSION, 4);
block_cache->root.roof = 1024;
@@ -493,10 +493,10 @@ ibex_block_cache_open(const char *name, int flags, int mode)
/* reset the file contents */
ftruncate(block_cache->fd, 1024);
} else {
- (printf("superblock already initialised:\n"
- " roof = %d\n free = %d\n words = %d\n names = %d\n tail = %d\n",
- block_cache->root.roof, block_cache->root.free,
- block_cache->root.words, block_cache->root.names, block_cache->root.tail));
+ d(printf("superblock already initialised:\n"
+ " roof = %d\n free = %d\n words = %d\n names = %d\n tail = %d\n",
+ block_cache->root.roof, block_cache->root.free,
+ block_cache->root.words, block_cache->root.names, block_cache->root.tail));
}
/* FIXME: this should be moved higher up in the object tree */
{
diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c
index 7a5864ea32..565b8f02dc 100644
--- a/libibex/ibex_block.c
+++ b/libibex/ibex_block.c
@@ -251,7 +251,7 @@ ibex *ibex_open (char *file, int flags, int mode)
int ibex_save (ibex *ib)
{
- printf("syncing database\n");
+ d(printf("syncing database\n"));
if (ib->predone) {
ib->words->klass->index_post(ib->words);
ib->predone = FALSE;
@@ -266,7 +266,7 @@ int ibex_close (ibex *ib)
{
int ret = 0;
- printf("closing database\n");
+ d(printf("closing database\n"));
if (ib->predone) {
ib->words->klass->index_post(ib->words);
diff --git a/libibex/index.h b/libibex/index.h
index 0cef7948b3..442cba8e25 100644
--- a/libibex/index.h
+++ b/libibex/index.h
@@ -25,7 +25,7 @@
/* an indexing 'class' maps a key to 1 piece of info */
-#define INDEX_STAT
+/*#define INDEX_STAT*/
struct _IBEXCursor {
struct _IBEXCursorClass *klass;
diff --git a/libibex/wordindexmem.c b/libibex/wordindexmem.c
index 9d26bb3697..0959c2be21 100644
--- a/libibex/wordindexmem.c
+++ b/libibex/wordindexmem.c
@@ -146,20 +146,20 @@ ibex_create_word_index_mem(struct _memcache *bc, blockid_t *wordroot, blockid_t
/* but not the same indexes! */
if (*wordroot) {
- printf("opening wordindex root = %d\n", *wordroot);
+ d(printf("opening wordindex root = %d\n", *wordroot));
idx->wordindex = ibex_hash_class.open(bc, *wordroot);
} else {
idx->wordindex = ibex_hash_class.create(bc, 2048);
*wordroot = idx->wordindex->root;
- printf("creating wordindex root = %d\n", *wordroot);
+ d(printf("creating wordindex root = %d\n", *wordroot));
}
if (*nameroot) {
- printf("opening nameindex root = %d\n", *nameroot);
+ d(printf("opening nameindex root = %d\n", *nameroot));
idx->nameindex = ibex_hash_class.open(bc, *nameroot);
} else {
idx->nameindex = ibex_hash_class.create(bc, 2048);
*nameroot = idx->nameindex->root;
- printf("creating nameindex root = %d\n", *nameroot);
+ d(printf("creating nameindex root = %d\n", *nameroot));
}
return idx;
}
@@ -198,7 +198,7 @@ static void word_index_pre(struct _IBEXWord *idx)
return;
/* want to load all words into the cache lookup table */
- printf("pre-loading all word info into memory\n");
+ d(printf("pre-loading all word info into memory\n"));
idc = idx->wordindex->klass->get_cursor(idx->wordindex);
while ( (wordid = idc->klass->next(idc)) ) {
key = idc->index->klass->get_key(idc->index, wordid, &len);
@@ -220,7 +220,7 @@ static void word_index_pre(struct _IBEXWord *idx)
idc->klass->close(idc);
- printf("done\n");
+ d(printf("done\n"));
}
static gboolean
@@ -357,7 +357,7 @@ static gboolean contains_name(struct _IBEXWord *idx, const char *name)
in the same list, not in buckets of keys for the same hash (among other reasons) */
if (!idx->nameinit) {
- printf("pre-loading all name info into memory\n");
+ d(printf("pre-loading all name info into memory\n"));
idc = idx->nameindex->klass->get_cursor(idx->nameindex);
while ( (wordid = idc->klass->next(idc)) ) {
key = idc->index->klass->get_key(idc->index, wordid, &len);
@@ -821,7 +821,8 @@ static char *
num(int num)
{
int n;
- char buf[256], *p = buf;
+ static char buf[256];
+ char *p = buf;
char type = 0;
n = num;