Update of /cvsroot/simplemail/simplemail
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12436
Modified Files:
index_external.c
Log Message:
Debugging functions for the external index are optional now.
Index: index_external.c
===================================================================
RCS file: /cvsroot/simplemail/simplemail/index_external.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- index_external.c 22 Feb 2014 09:40:57 -0000 1.54
+++ index_external.c 22 Feb 2014 09:41:15 -0000 1.55
@@ -47,6 +47,9 @@
#include <varargs.h>
#endif
+/* Define this if some debug options should be compiled in */
+/*#define DEBUG_FUNCTIONS*/
+
struct bnode_element
{
int str_offset;
@@ -341,7 +344,9 @@
if (block == lchild && !tmp->leaf)
{
+#ifdef DEBUG_FUNCTIONS
fprintf(stderr, "Endless loop detected!\n");
+#endif
return 0;
}
@@ -372,6 +377,8 @@
memset(e, (idx->max_elements_per_node - start)*sizeof(struct bnode_element), 0);
}
+#ifdef DEBUG_FUNCTIONS
+
/**
* Dump the children of the given nodes.
*/
@@ -566,6 +573,8 @@
return count;
}
+#endif
+
/**
* Inserts the given string into the bnode tree.
*
@@ -602,8 +611,10 @@
if (!tmp->leaf && current_level == path.max_level)
{
+#ifdef DEBUG_FUNCTIONS
fprintf(stderr, "Cannot insert into a non-leaf\n");
exit(1);
+#endif
}
/* Recall that we allocate in our temps one more entry than it would fit in the block, so we surly can
@@ -648,7 +659,9 @@
if (block == idx->root_node)
{
+#ifdef DEBUG_FUNCTIONS
assert(current_level == 0);
+#endif
/* Create a new root block if the root was getting full */
tmp->num_elements = 1;
@@ -943,10 +956,13 @@
if (num_substrings != 1)
{
+#ifdef DEBUG_FUNCTIONS
fprintf(stderr, "Searching with only one sub string is supported for now.\n");
exit(-1);
+#else
+ return 0;
+#endif
}
-
va_copy(substrings_copy,substrings);
for (i=0;i<num_substrings;i++)
|