Commit c5af1cbb authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Get rid of many icc warnings. Addresses #1185.

git-svn-id: file:///svn/tokudb.1131b+1080a+1185@6390 c7de825b-a66e-492c-adef-691d508d4ae1
parent 323dbd4e
......@@ -10,9 +10,11 @@ VISIBILITY = -fvisibility=hidden
# PROF_FLAGS=-pg
OPTFLAGS = -O3 -finline-functions
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS = -W -Wall -Wextra -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CFLAGS = -W -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
ifneq ($(CC),icc)
CFLAGS += -Werror
CFLAGS += -Werror -Wall -Wextra -g3 -ggdb3
else
CFLAGS += -g
endif
CFLAGS += -Wbad-function-cast -Wcast-align
CPPFLAGS = -I../include -I../newbrt -I./lock_tree/ -I./range_tree/
......
......@@ -13,9 +13,15 @@ else
GCOV_FLAGS =
endif
CFLAGS = -W -Wall -Wextra -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CFLAGS = -Werror -Wall -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
ifneq ($(CC),icc)
CFLAGS += -W -Wextra -g3 -ggdb3
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
else
CFLAGS += -g
CFLAGS += -diag-disable 589 # Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
endif
CPPFLAGS = -I. -I../../include -I../../newbrt
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += $(VISIBILITY) $(PROF_FLAGS)
......
......@@ -66,8 +66,8 @@ static inline BOOL toku__rt_overlap(toku_range_tree* tree,
assert(a);
assert(b);
//a->left <= b->right && b->left <= a->right
return (tree->end_cmp(a->left, b->right) <= 0 &&
tree->end_cmp(b->left, a->right) <= 0);
return (BOOL)((tree->end_cmp(a->left, b->right) <= 0) &&
(tree->end_cmp(b->left, a->right) <= 0));
}
static inline BOOL toku__rt_exact(toku_range_tree* tree,
......@@ -76,9 +76,9 @@ static inline BOOL toku__rt_exact(toku_range_tree* tree,
assert(a);
assert(b);
return (tree->end_cmp (a->ends.left, b->ends.left) == 0 &&
tree->end_cmp (a->ends.right, b->ends.right) == 0 &&
tree->data_cmp(a->data, b->data) == 0);
return (BOOL)((tree->end_cmp (a->ends.left, b->ends.left) == 0) &&
(tree->end_cmp (a->ends.right, b->ends.right) == 0) &&
(tree->data_cmp(a->data, b->data) == 0));
}
static inline int toku__rt_cmp(toku_range_tree* tree,
......@@ -231,7 +231,7 @@ int toku_rt_predecessor (toku_range_tree* tree, toku_point* point,
best = &tree->i.ranges[i];
}
}
*wasfound = best != NULL;
*wasfound = (BOOL)(best != NULL);
if (best) *pred = *best;
return 0;
}
......@@ -249,7 +249,7 @@ int toku_rt_successor (toku_range_tree* tree, toku_point* point,
best = &tree->i.ranges[i];
}
}
*wasfound = best != NULL;
*wasfound = (BOOL)(best != NULL);
if (best) *succ = *best;
return 0;
}
......
......@@ -57,7 +57,7 @@ int toku_rt_create(toku_range_tree** ptree,
}
static int rt_clear_helper(OMTVALUE value, u_int32_t UU(index), void* extra) {
void (*user_free)(void*) = extra;
void (*user_free)(void*) = (void(*)(void*))extra;
user_free(value);
return 0;
}
......
......@@ -13,9 +13,15 @@ endif
OPTFLAGS=-O0
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS = -W -Wall -Wextra $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS = -Werror -Wall $(OPTFLAGS) $(GCOV_FLAGS)
ifneq ($(CC),icc)
CFLAGS += -W -Wextra -g3 -ggdb3
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
else
CFLAGS += -g
CFLAGS += -diag-disable 981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
endif
CPPFLAGS += -I../ -I../../../newbrt -I../../../include
LDFLAGS = -lpthread
......
static toku_interval *
init_query(toku_interval* range, int left, int right) {
range->left = (toku_point*)&nums[left];
range->right = (toku_point*)&nums[right];
return range;
}
static toku_range *
init_range (toku_range* range, int left, int right, int data) {
init_query(&range->ends, left, right);
if (data < 0) range->data = 0;
else range->data = (TXNID)letters[data];
return range;
}
static void
setup_tree (BOOL allow_overlaps, BOOL insert, int left, int right, int data) {
int r;
toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc);
CKERR(r);
if (insert) {
r = toku_rt_insert(tree, init_range(&range, left, right, data));
CKERR(r);
}
}
static void
close_tree (void) {
int r;
r = toku_rt_close(tree); CKERR(r);
}
static void
runinsert (int rexpect, toku_range* toinsert) {
int r;
r = toku_rt_insert(tree, toinsert);
CKERR2(r, rexpect);
}
static __attribute__((__unused__)) void
runsearch (int rexpect, toku_interval* query, toku_range* expect);
static void
runsearch (int rexpect, toku_interval* query, toku_range* expect) {
int r;
unsigned found;
r = toku_rt_find(tree, query, 0, &buf, &buflen, &found);
CKERR2(r, rexpect);
if (rexpect != 0) return;
assert(found == 1);
assert(int_cmp(buf[0].ends.left, expect->ends.left) == 0 &&
int_cmp(buf[0].ends.right, expect->ends.right) == 0 &&
char_cmp(buf[0].data, expect->data) == 0);
}
static __attribute__((__unused__)) void
runlimitsearch (toku_interval* query, unsigned limit, unsigned findexpect);
static void
runlimitsearch (toku_interval* query, unsigned limit, unsigned findexpect) {
int r;
unsigned found;
r=toku_rt_find(tree, query, limit, &buf, &buflen, &found); CKERR(r);
verify_all_overlap(query, buf, found);
assert(found == findexpect);
}
......@@ -11,7 +11,8 @@ int verbose=0;
#define CKERR(r) ({ if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, strerror(r)); assert(r==0); })
#define CKERR2(r,r2) ({ if (r!=r2) fprintf(stderr, "%s:%d error %d %s, expected %d\n", __FILE__, __LINE__, r, strerror(r), r2); assert(r==r2); })
void parse_args (int argc, const char *argv[]) {
static inline void
parse_args (int argc, const char *argv[]) {
const char *argv0=argv[0];
while (argc>1) {
int resultcode=0;
......@@ -41,22 +42,26 @@ static inline u_int32_t myrandom (void) {
}
int dummy_cmp(const toku_point *a __attribute__((__unused__)),
const toku_point *b __attribute__((__unused__))) {
static inline int
dummy_cmp (const toku_point *a __attribute__((__unused__)),
const toku_point *b __attribute__((__unused__))) {
return 0;
}
int TXNID_cmp(const TXNID a, const TXNID b) {
static inline int
TXNID_cmp (const TXNID a, const TXNID b) {
return a < b ? -1 : (a != b); /* \marginpar{!?} */
}
int int_cmp(const toku_point* a, const toku_point*b) {
static inline int
int_cmp (const toku_point* a, const toku_point*b) {
int x = *(int*)a;
int y = *(int*)b;
return x -y;
}
int char_cmp(const TXNID a, const TXNID b) {
static inline int
char_cmp (const TXNID a, const TXNID b) {
int x = (char)a;
int y = (char)b;
return x -y;
......@@ -65,7 +70,8 @@ int char_cmp(const TXNID a, const TXNID b) {
int mallocced = 0;
int failon = -1;
void* fail_malloc(size_t size) {
static inline void*
fail_malloc (size_t size) {
if (++mallocced == failon) {
errno = ENOMEM;
return NULL;
......@@ -73,7 +79,8 @@ void* fail_malloc(size_t size) {
return malloc(size);
}
void verify_all_overlap(toku_interval* query, toku_range* list, unsigned listlen) {
static inline void
verify_all_overlap (toku_interval* query, toku_range* list, unsigned listlen) {
unsigned i;
for (i = 0; i < listlen; i++) {
......
......@@ -10,7 +10,7 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv);
for (allow_overlaps = 0; allow_overlaps < 2; allow_overlaps++) {
for (allow_overlaps = FALSE; allow_overlaps <= TRUE; allow_overlaps++) {
#ifdef TOKU_RT_NOOVERLAPS
if (allow_overlaps) continue;
#endif
......@@ -28,7 +28,7 @@ int main(int argc, const char *argv[]) {
tree = NULL;
}
for (allow_overlaps = 0; allow_overlaps < 2; allow_overlaps++) {
for (allow_overlaps = FALSE; allow_overlaps <= TRUE; allow_overlaps++) {
#ifdef TOKU_RT_NOOVERLAPS
if (allow_overlaps) continue;
#endif
......
......@@ -15,7 +15,8 @@ static void* malloc_fail(size_t size) {
return malloc(size);
}
void RunTest (BOOL f_overlaps_allowed) {
static void
RunTest (BOOL f_overlaps_allowed) {
int i, j;
int r;
toku_range_tree *tree;
......
......@@ -2,7 +2,8 @@
#include "test.h"
void run_test (BOOL overlap_allowed) {
static void
run_test (BOOL overlap_allowed) {
int r;
toku_range_tree *tree;
toku_range range;
......
......@@ -9,64 +9,10 @@ toku_range_tree *tree;
toku_range* buf;
unsigned buflen;
toku_interval* init_query(toku_interval* range, int left, int right) {
range->left = (toku_point*)&nums[left];
range->right = (toku_point*)&nums[right];
return range;
}
toku_range* init_range(toku_range* range, int left, int right, int data) {
init_query(&range->ends, left, right);
if (data < 0) range->data = 0;
else range->data = (TXNID)letters[data];
return range;
}
void setup_tree(BOOL allow_overlaps, BOOL insert, int left, int right, int data) {
int r;
toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc);
CKERR(r);
if (insert) {
r = toku_rt_insert(tree, init_range(&range, left, right, data));
CKERR(r);
}
}
void close_tree(void) {
int r;
r = toku_rt_close(tree); CKERR(r);
}
void runsearch(int rexpect, toku_interval* query, toku_range* expect) {
int r;
unsigned found;
r = toku_rt_find(tree, query, 0, &buf, &buflen, &found);
CKERR2(r, rexpect);
if (rexpect != 0) return;
assert(found == 1);
assert(int_cmp(buf[0].ends.left, expect->ends.left) == 0 &&
int_cmp(buf[0].ends.right, expect->ends.right) == 0 &&
char_cmp(buf[0].data, expect->data) == 0);
}
void runinsert(int rexpect, toku_range* toinsert) {
int r;
r = toku_rt_insert(tree, toinsert);
CKERR2(r, rexpect);
}
void runlimitsearch(toku_interval* query, unsigned limit, unsigned findexpect) {
int r;
unsigned found;
r=toku_rt_find(tree, query, limit, &buf, &buflen, &found); CKERR(r);
verify_all_overlap(query, buf, found);
assert(found == findexpect);
}
#include "run.h"
void tests(BOOL allow_overlaps) {
static void
tests (BOOL allow_overlaps) {
toku_interval query;
toku_range insert;
/*
......
......@@ -9,53 +9,9 @@ toku_range_tree *tree;
toku_range* buf;
unsigned buflen;
toku_interval* init_query(toku_interval* range, int left, int right) {
range->left = (toku_point*)&nums[left];
range->right = (toku_point*)&nums[right];
return range;
}
toku_range* init_range(toku_range* range, int left, int right, int data) {
init_query(&range->ends, left, right);
if (data < 0) range->data = 0;
else range->data = (TXNID)letters[data];
return range;
}
void setup_tree(BOOL allow_overlaps, int left, int right, int data) {
int r;
toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc);
CKERR(r);
r = toku_rt_insert(tree, init_range(&range, left, right, data));CKERR(r);
}
void close_tree(void) {
int r;
r = toku_rt_close(tree); CKERR(r);
}
void runsearch(int rexpect, toku_interval* query, toku_range* expect) {
int r;
unsigned found;
r = toku_rt_find(tree, query, 0, &buf, &buflen, &found);
CKERR2(r, rexpect);
if (rexpect != 0) return;
assert(found == 1);
assert(int_cmp(buf[0].ends.left, expect->ends.left) == 0 &&
int_cmp(buf[0].ends.right, expect->ends.right) == 0 &&
char_cmp(buf[0].data, expect->data) == 0);
}
void runinsert(int rexpect, toku_range* toinsert) {
int r;
r = toku_rt_insert(tree, toinsert);
CKERR2(r, rexpect);
}
#include "run.h"
void verify_overlap(BOOL allow_overlaps) {
static void verify_overlap(BOOL allow_overlaps) {
int r;
BOOL allowed;
......@@ -64,7 +20,7 @@ void verify_overlap(BOOL allow_overlaps) {
assert(allowed == allow_overlaps);
}
void tests(BOOL allow_overlaps) {
static void tests(BOOL allow_overlaps) {
toku_range expect;
toku_interval query;
toku_range toinsert;
......@@ -81,23 +37,23 @@ void tests(BOOL allow_overlaps) {
/* Tree: {|0-1|}, query of |1-2| returns |0-1|
In this test, I am also going to verify that the allow_overlaps bit
is set appropriately. */
setup_tree(allow_overlaps, 0, 1, 0);
setup_tree(allow_overlaps, TRUE, 0, 1, 0);
verify_overlap(allow_overlaps);
runsearch(0, init_query(&query, 1, 2), init_range(&expect, 0, 1, 0));
close_tree();
/* Tree: {|1-2|}, query of |0-1| returns |1-2| */
setup_tree(allow_overlaps, 1, 2, 0);
setup_tree(allow_overlaps, TRUE, 1, 2, 0);
runsearch(0, init_query(&query, 0, 1), init_range(&expect, 1, 2, 0));
close_tree();
/* Tree: {|1-2|}, insert of of |0-1| success == allow_overlaps */
setup_tree(allow_overlaps, 1, 2, 0);
setup_tree(allow_overlaps, TRUE, 1, 2, 0);
runinsert((allow_overlaps ? 0 : EDOM), init_range(&toinsert, 0, 1, 0));
close_tree();
/* Tree: {|0-1|}, insert of of |1-2| success == allow_overlaps */
setup_tree(allow_overlaps, 0, 1, 0);
setup_tree(allow_overlaps, TRUE, 0, 1, 0);
runinsert((allow_overlaps ? 0 : EDOM), init_range(&toinsert, 1, 2, 0));
close_tree();
......@@ -111,22 +67,22 @@ void tests(BOOL allow_overlaps) {
*/
/* Tree: {|0-3|}, query of |1-2| returns |0-3| */
setup_tree(allow_overlaps, 0, 3, 0);
setup_tree(allow_overlaps, TRUE, 0, 3, 0);
runsearch(0, init_query(&query, 1, 2), init_range(&expect, 0, 3, 0));
close_tree();
/* Tree: {|1-2|}, query of |0-3| returns |1-2| */
setup_tree(allow_overlaps, 1, 2, 0);
setup_tree(allow_overlaps, TRUE, 1, 2, 0);
runsearch(0, init_query(&query, 0, 3), init_range(&expect, 1, 2, 0));
close_tree();
/* Tree: {|1-2|}, insert of of |0-3| success == allow_overlaps */
setup_tree(allow_overlaps, 1, 2, 0);
setup_tree(allow_overlaps, TRUE, 1, 2, 0);
runinsert((allow_overlaps ? 0 : EDOM), init_range(&toinsert, 0, 3, 0));
close_tree();
/* Tree: {|0-3|}, insert of of |1-2| success == allow_overlaps */
setup_tree(allow_overlaps, 0, 3, 0);
setup_tree(allow_overlaps, TRUE, 0, 3, 0);
runinsert((allow_overlaps ? 0 : EDOM), init_range(&toinsert, 1, 2, 0));
close_tree();
......@@ -138,12 +94,12 @@ void tests(BOOL allow_overlaps) {
*/
/* Tree: {|0-3|}, query of |0-3| returns |0-3| */
setup_tree(allow_overlaps, 0, 3, 0);
setup_tree(allow_overlaps, TRUE, 0, 3, 0);
runsearch(0, init_query(&query, 0, 3), init_range(&expect, 0, 3, 0));
close_tree();
/* Tree: {(|0-3|,0)}, insert of of (|0-3|,1) success == allow_overlaps */
setup_tree(allow_overlaps, 0, 3, 0);
setup_tree(allow_overlaps, TRUE, 0, 3, 0);
runinsert((allow_overlaps ? 0 : EDOM), init_range(&toinsert, 0, 3, 1));
close_tree();
}
......
......@@ -10,71 +10,17 @@ toku_range_tree *tree;
toku_range* buf;
unsigned buflen;
toku_interval* init_query(toku_interval* range, unsigned left, unsigned right) {
range->left = (toku_point*)&nums[left];
range->right = (toku_point*)&nums[right];
return range;
}
toku_range* init_range(toku_range* range, unsigned left, unsigned right, int data) {
init_query(&range->ends, left, right);
if (data < 0) range->data = 0;
else range->data = (TXNID)letters[data];
return range;
}
#include "run.h"
void setup_tree(BOOL allow_overlaps, BOOL insert,
unsigned left, unsigned right, unsigned data) {
int r;
toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc);
CKERR(r);
if (insert) {
r = toku_rt_insert(tree, init_range(&range, left, right, (int)data));
CKERR(r);
}
}
void close_tree(void) {
int r;
r = toku_rt_close(tree); CKERR(r);
}
void runsearch(int rexpect, toku_interval* query, toku_range* expect) {
int r;
unsigned found;
r = toku_rt_find(tree, query, 0, &buf, &buflen, &found);
CKERR2(r, rexpect);
if (rexpect != 0) return;
assert(found == 1);
assert(int_cmp(buf[0].ends.left, expect->ends.left) == 0 &&
int_cmp(buf[0].ends.right, expect->ends.right) == 0 &&
char_cmp(buf[0].data, expect->data) == 0);
}
void runinsert(int rexpect, toku_range* toinsert) {
int r;
r = toku_rt_insert(tree, toinsert);
CKERR2(r, rexpect);
}
void rundelete(int rexpect, toku_range* todelete) {
static void
rundelete (int rexpect, toku_range* todelete) {
int r;
r = toku_rt_delete(tree, todelete);
CKERR2(r, rexpect);
}
void runlimitsearch(toku_interval* query, unsigned limit, unsigned findexpect) {
int r;
unsigned found;
r=toku_rt_find(tree, query, limit, &buf, &buflen, &found); CKERR(r);
verify_all_overlap(query, buf, found);
assert(found == findexpect);
}
void tests(BOOL allow_overlaps) {
static void
tests (BOOL allow_overlaps) {
toku_range insert;
unsigned i;
/* Force buf to increase. */
......
......@@ -7,41 +7,17 @@ toku_range_tree *tree;
toku_range* buf;
unsigned buflen;
toku_interval* init_query(toku_interval* range, int left, int right) {
range->left = (toku_point*)&nums[left];
range->right = (toku_point*)&nums[right];
return range;
}
toku_range* init_range(toku_range* range, int left, int right, int data) {
init_query(&range->ends, left, right);
if (data < 0) range->data = 0;
else range->data = (TXNID)letters[data];
return range;
}
#include "run.h"
void* init_point(unsigned left) {
static void *
init_point (unsigned left) {
assert(left < sizeof(nums) / sizeof(nums[0]));
return ((toku_point*)&nums[left]);
}
void setup_tree(BOOL allow_overlaps, BOOL insert, int left, int right, int data) {
int r;
toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc);
CKERR(r);
if (insert) {
r = toku_rt_insert(tree, init_range(&range, left, right, data));
CKERR(r);
}
}
void close_tree(void) {
int r;
r = toku_rt_close(tree); CKERR(r);
}
void runsearch(int rexpect, toku_interval* query, toku_range* expect) {
#if 0
static void
runsearch (int rexpect, toku_interval* query, toku_range* expect) {
int r;
unsigned found;
r = toku_rt_find(tree, query, 0, &buf, &buflen, &found);
......@@ -53,25 +29,12 @@ void runsearch(int rexpect, toku_interval* query, toku_range* expect) {
int_cmp(buf[0].ends.right, expect->ends.right) == 0 &&
char_cmp(buf[0].data, expect->data) == 0);
}
void runinsert(int rexpect, toku_range* toinsert) {
int r;
r = toku_rt_insert(tree, toinsert);
CKERR2(r, rexpect);
}
void runlimitsearch(toku_interval* query, unsigned limit, unsigned findexpect) {
int r;
unsigned found;
r=toku_rt_find(tree, query, limit, &buf, &buflen, &found); CKERR(r);
verify_all_overlap(query, buf, found);
assert(found == findexpect);
}
#endif
typedef enum {PRED=0, SUCC=1} predsucc;
void runtest(predsucc testtype, toku_point* query, BOOL findexpect,
unsigned left, unsigned right, unsigned data) {
static void
runtest (predsucc testtype, toku_point* query, BOOL findexpect,
unsigned left, unsigned right, unsigned data) {
int r;
BOOL found;
toku_range out;
......@@ -96,7 +59,8 @@ void runtest(predsucc testtype, toku_point* query, BOOL findexpect,
}
void tests(BOOL allow_overlaps) {
static void
tests (BOOL allow_overlaps) {
toku_range insert;
/*
......
......@@ -45,9 +45,13 @@ endif
LIBNAME=libdb.$(LIBEXT)
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS += -Wall $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wall $(OPTFLAGS) $(GCOV_FLAGS)
ifneq ($(CC),icc)
CFLAGS += -Werror
CFLAGS += -Werror -g3 -ggdb3
else
CFLAGS += -g
CFLAGS += -diag-disable 981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
endif
TDB_CPPFLAGS = -I../../include
......
......@@ -49,7 +49,8 @@ static void lookup (int i, int expect, int expectj) {
}
}
void test_abort_abort (void) {
static void
test_abort_abort (void) {
int i, r;
r=env->txn_begin(env, 0, &xchild, 0); CKERR(r);
for (i=0; i<N/2; i++) {
......@@ -75,7 +76,8 @@ void test_abort_abort (void) {
r=xchild->commit(xchild, 0); CKERR(r);
}
void setup (void) {
static void
setup (void) {
DB_TXN *txn;
int r;
system("rm -rf " ENVDIR);
......@@ -95,7 +97,8 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
......
......@@ -49,7 +49,8 @@ static void lookup (int i, int expect, int expectj) {
}
}
void test_abort_commit (void) {
static void
test_abort_commit (void) {
int i, r;
r=env->txn_begin(env, 0, &xchild, 0); CKERR(r);
for (i=0; i<N/2; i++) {
......@@ -75,7 +76,8 @@ void test_abort_commit (void) {
r=xchild->commit(xchild, 0); CKERR(r);
}
void setup (void) {
static void
setup (void) {
DB_TXN *txn;
int r;
system("rm -rf " ENVDIR);
......@@ -95,7 +97,8 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
......
......@@ -49,7 +49,8 @@ static void lookup (int i, int expect, int expectj) {
}
}
void test_commit_abort (void) {
static void
test_commit_abort (void) {
int i, r;
r=env->txn_begin(env, 0, &xparent, 0); CKERR(r);
r=env->txn_begin(env, xparent, &xchild, 0); CKERR(r);
......@@ -70,7 +71,8 @@ void test_commit_abort (void) {
r=xchild->commit(xchild, 0); CKERR(r);
}
void setup (void) {
static void
setup (void) {
DB_TXN *txn;
int r;
system("rm -rf " ENVDIR);
......@@ -91,7 +93,8 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
......
......@@ -49,7 +49,8 @@ static void lookup (int i, int expect, int expectj) {
int N = 50000;
void test_commit_commit (void) {
static void
test_commit_commit (void) {
int i, r;
r=env->txn_begin(env, 0, &xparent, 0); CKERR(r);
r=env->txn_begin(env, xparent, &xchild, 0); CKERR(r);
......@@ -70,7 +71,8 @@ void test_commit_commit (void) {
r=xchild->commit(xchild, 0); CKERR(r);
}
void setup (void) {
static void
setup (void) {
DB_TXN *txn;
int r;
system("rm -rf " ENVDIR);
......@@ -91,7 +93,8 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
......
......@@ -3,7 +3,8 @@
#include "test.h"
#include <sys/stat.h>
void do_627 (void) {
static void
do_627 (void) {
int r;
DB_ENV *env;
DB *db;
......
......@@ -8,14 +8,15 @@ DB_TXN *txn;
const int num_insert = 25000;
void setup (void) {
static void
setup (void) {
system("rm -rf " ENVDIR);
int r;
r=mkdir(ENVDIR, 0777); CKERR(r);
r=db_env_create(&env, 0); CKERR(r);
env->set_errfile(env, stderr);
#if USE_BDB
#ifdef USE_BDB
r=env->set_lk_max_objects(env, 2*num_insert); CKERR(r);
#endif
r=env->set_lk_max_locks(env, 2*num_insert); CKERR(r);
......@@ -29,13 +30,15 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r= db->close(db, 0); CKERR(r);
r= env->close(env, 0); CKERR(r);
}
void doit (BOOL committed_provdels) {
static void
doit (BOOL committed_provdels) {
DBT key,data;
DBC *dbc;
int r;
......
......@@ -6,7 +6,8 @@ static DB_ENV *env;
static DB *db;
DB_TXN *txn;
void setup (void) {
static void
setup (void) {
system("rm -rf " ENVDIR);
int r;
r=mkdir(ENVDIR, 0777); CKERR(r);
......@@ -21,13 +22,15 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r= db->close(db, 0); CKERR(r);
r= env->close(env, 0); CKERR(r);
}
void doit (void) {
static void
doit (void) {
DBT key,data;
int r;
r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
......
......@@ -12,7 +12,8 @@ static DB_ENV *env;
static DB *dbs[NFILES];
DB_TXN *txn;
void setup (void) {
static void
setup (void) {
system("rm -rf " ENVDIR);
int r;
r=mkdir(ENVDIR, 0777); CKERR(r);
......@@ -35,7 +36,8 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int i;
int r;
for (i=0; i<NFILES; i++) {
......@@ -44,7 +46,8 @@ void shutdown (void) {
r= env->close(env, 0); CKERR(r);
}
void doit (void) {
static void
doit (void) {
int j;
int r;
struct timeval startt, endt;
......
......@@ -50,7 +50,8 @@ static void lookup (int i, int expect, int expectj) {
const int N = 50000;
const int DIV = 10;
void test_commit_commit (void) {
static void
test_commit_commit (void) {
int i, j, k, r;
r=env->txn_begin(env, 0, &xparent, 0); CKERR(r);
k=0;
......@@ -79,7 +80,8 @@ void test_commit_commit (void) {
r=xchild->commit(xchild, 0); CKERR(r);
}
void setup (void) {
static void
setup (void) {
DB_TXN *txn;
int r;
system("rm -rf " ENVDIR);
......@@ -100,7 +102,8 @@ void setup (void) {
r=txn->commit(txn, 0); assert(r==0);
}
void shutdown (void) {
static void
shutdown (void) {
int r;
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
......
......@@ -27,7 +27,8 @@ int verbose=0;
#define CKERR_depending(r,tdbexpect,bdbexpect) CKERR2(r,bdbexpect)
#endif
void parse_args (int argc, const char *argv[]) {
static __attribute__((__unused__)) void
parse_args (int argc, const char *argv[]) {
const char *argv0=argv[0];
while (argc>1) {
int resultcode=0;
......@@ -49,14 +50,16 @@ void parse_args (int argc, const char *argv[]) {
}
}
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
static __attribute__((__unused__)) DBT *
dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
static __attribute__((__unused__)) DBT *
dbt_init_malloc (DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
......@@ -72,7 +75,8 @@ static inline u_int32_t myrandom (void) {
return rstate;
}
int int_dbt_cmp(DB *db, const DBT *a, const DBT *b) {
static __attribute__((__unused__)) int
int_dbt_cmp (DB *db, const DBT *a, const DBT *b) {
assert(db && a && b);
assert(a->size == sizeof(int));
assert(b->size == sizeof(int));
......
......@@ -4,12 +4,15 @@
#include "test.h"
unsigned char N=5;
int fact(int n) {
static int
fact(int n) {
if (n<=2) return n;
else return n*fact(n-1);
}
void swapc (unsigned char *a, unsigned char *b) {
static void
swapc (unsigned char *a, unsigned char *b) {
unsigned char tmp=*a;
*a=*b;
*b=tmp;
......@@ -18,12 +21,13 @@ void swapc (unsigned char *a, unsigned char *b) {
DB_ENV *env;
DB *db;
void run (int choice) {
static void
run (int choice) {
unsigned char v[N];
int i;
int r;
for (i=0; i<N; i++) {
v[i]=10*i;
v[i]=(unsigned char)(10*i);
}
for (i=0; i<N; i++) {
int nchoices=N-i;
......
......@@ -5,21 +5,18 @@
#include <arpa/inet.h>
unsigned char N=5;
int fact(int n) {
static int
fact (int n) {
if (n<=2) return n;
else return n*fact(n-1);
}
void swapc (unsigned char *a, unsigned char *b) {
unsigned char tmp=*a;
*a=*b;
*b=tmp;
}
DB_ENV *env;
DB *db;
void run (void) {
static void
run (void) {
int r;
DB_TXN *txn;
char v101=101, v102=102, v1=1, v2=2;
......
......@@ -5,21 +5,18 @@
#include <arpa/inet.h>
unsigned char N=5;
int fact(int n) {
static int
fact (int n) {
if (n<=2) return n;
else return n*fact(n-1);
}
void swapc (unsigned char *a, unsigned char *b) {
unsigned char tmp=*a;
*a=*b;
*b=tmp;
}
DB_ENV *env;
DB *db;
void run (void) {
static void
run (void) {
int r;
DB_TXN *txn, *txn2;
char v101=101, v102=102, v1=1, v2=1;
......
......@@ -4,12 +4,15 @@
#include "test.h"
unsigned char N=8;
int fact(int n) {
static int
fact (int n) {
if (n<=2) return n;
else return n*fact(n-1);
}
void swapc (unsigned char *a, unsigned char *b) {
static void
swapc (unsigned char *a, unsigned char *b) {
unsigned char tmp=*a;
*a=*b;
*b=tmp;
......@@ -18,12 +21,13 @@ void swapc (unsigned char *a, unsigned char *b) {
DB_ENV *env;
DB *db;
void run (int choice) {
static void
run (int choice) {
unsigned char v[N];
int i;
int r;
for (i=0; i<N; i++) {
v[i]=i;
v[i]=(unsigned char)i;
}
for (i=0; i<N; i++) {
int nchoices=N-i;
......
......@@ -4,12 +4,15 @@
#include "test.h"
unsigned char N=8;
int fact(int n) {
static int
fact (int n) {
if (n<=2) return n;
else return n*fact(n-1);
}
void swapc (unsigned char *a, unsigned char *b) {
static void
swapc (unsigned char *a, unsigned char *b) {
unsigned char tmp=*a;
*a=*b;
*b=tmp;
......@@ -18,12 +21,13 @@ void swapc (unsigned char *a, unsigned char *b) {
DB_ENV *env;
DB *db;
void run (int choice) {
static void
run (int choice) {
unsigned char v[N];
int i;
int r;
for (i=0; i<N; i++) {
v[i]=i;
v[i]=(char)i;
}
for (i=0; i<N; i++) {
int nchoices=N-i;
......
......@@ -9,12 +9,8 @@
#include <db.h>
#include "test.h"
DBT *dbt_init_static(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
return dbt;
}
void test_789(void) {
static void
test_789(void) {
int r;
/* setup test directory */
......
......@@ -10,7 +10,8 @@
#include <db.h>
#include "test.h"
void testit(const int klen, const int vlen, const int n, const int lastvlen) {
static void
testit (const int klen, const int vlen, const int n, const int lastvlen) {
if (verbose) printf("testit %d %d %d %d\n", klen, vlen, n, lastvlen);
int r;
......
......@@ -15,7 +15,8 @@
// ENVDIR is defined in the Makefile
void test_db_open_aborts (void) {
static void
test_db_open_aborts (void) {
DB_ENV *env;
DB *db;
......@@ -55,7 +56,8 @@ void test_db_open_aborts (void) {
}
// Do two transactions, one commits, and one aborts. Do them concurrently.
void test_db_put_aborts (void) {
static void
test_db_put_aborts (void) {
DB_ENV *env;
DB *db;
......
......@@ -12,7 +12,8 @@ static DB_ENV *env;
static DB *db;
static DB_TXN *txn;
void insert (int i, int j) {
static void
insert (int i, int j) {
char hello[30], there[230];
DBT key,data;
snprintf(hello, sizeof(hello), "hello%d", i);
......@@ -24,7 +25,8 @@ void insert (int i, int j) {
CKERR(r);
}
void do_test_abort2 (void) {
static void
do_test_abort2 (void) {
int r;
system("rm -rf " ENVDIR);
r=mkdir(ENVDIR, 0777); assert(r==0);
......
......@@ -61,7 +61,8 @@ static void lookup (int i, int expect, int expectj) {
}
}
void test_abort3 (void) {
static void
test_abort3 (void) {
int r;
system("rm -rf " ENVDIR);
r=mkdir(ENVDIR, 0777); assert(r==0);
......
......@@ -15,7 +15,8 @@ static DB_ENV *env;
static DB *db;
static DB_TXN *txn;
void insert (int i) {
static void
insert (int i) {
char hello[30], there[30];
DBT key,data;
snprintf(hello, sizeof(hello), "hello%d", i);
......@@ -27,7 +28,8 @@ void insert (int i) {
CKERR(r);
}
void delete (int i) {
static void
delete (int i) {
char hello[30];
DBT key;
snprintf(hello, sizeof(hello), "hello%d", i);
......@@ -37,7 +39,8 @@ void delete (int i) {
CKERR(r);
}
void find (int i) {
static void
find (int i) {
char hello[30];
DBT key, val;
memset(&val,0,sizeof(val));
......@@ -49,7 +52,8 @@ void find (int i) {
CKERR(r);
}
void find_first_or_last (int i, int cflag) {
static void
find_first_or_last (int i, int cflag) {
int r;
DBC *cursor;
DBT key, val;
......@@ -71,9 +75,10 @@ void find_first_or_last (int i, int cflag) {
r = cursor->c_close(cursor);
}
void do_abort_delete_first_or_last(int N,
int first // 1 for first, 0 for last
) {
static void
do_abort_delete_first_or_last(int N,
int first // 1 for first, 0 for last
) {
int r,i;
system("rm -rf " ENVDIR);
r=mkdir(ENVDIR, 0777); assert(r==0);
......
......@@ -13,24 +13,27 @@
#include "test.h"
u_int64_t size_from(u_int32_t gbytes, u_int32_t bytes) {
#if USE_BDB
static u_int64_t
size_from (u_int32_t gbytes, u_int32_t bytes) {
#ifdef USE_BDB
if (sizeof (intptr_t) == 4 && gbytes == 4 && bytes == 0)
return 0xffffffff;
#endif
return ((u_int64_t)gbytes << 30) + bytes;
}
void size_to(u_int64_t s, u_int32_t *gbytes, u_int32_t *bytes) {
static void
size_to (u_int64_t s, u_int32_t *gbytes, u_int32_t *bytes) {
*gbytes = s >> 30;
*bytes = s & ((1<<30) - 1);
}
void expect_le(u_int64_t a, u_int32_t gbytes, u_int32_t bytes) {
static void
expect_le (u_int64_t a, u_int32_t gbytes, u_int32_t bytes) {
u_int64_t b = size_from(gbytes, bytes);
if (a != b && verbose)
printf("WARNING: expect %" PRId64 " got %" PRId64 "\n", a, b);
#if USE_BDB
printf("WARNING: expect %" PRIu64 " got %" PRIu64 "\n", a, b);
#ifdef USE_BDB
if (a > b) {
assert(a == 4ULL<<30 && b == a-1); return;
}
......@@ -39,7 +42,8 @@ void expect_le(u_int64_t a, u_int32_t gbytes, u_int32_t bytes) {
}
void test_cachesize() {
static void
test_cachesize (void) {
#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
int r;
DB_ENV *env;
......
......@@ -13,7 +13,8 @@
#include "test.h"
void test_cursor(void) {
static void
test_cursor (void) {
if (verbose) printf("test_cursor\n");
DB_ENV * env;
......@@ -49,22 +50,22 @@ void test_cursor(void) {
DBT v0; memset(&v0, 0, sizeof v0);
r = cursor[0]->c_get(cursor[0], &k0, &v0, DB_FIRST); assert(r == 0);
if (verbose) {
printf("k0:%p:%d\n", k0.data, k0.size);
printf("v0:%p:%d\n", v0.data, v0.size);
printf("k0:%p:%u\n", k0.data, k0.size);
printf("v0:%p:%u\n", v0.data, v0.size);
}
DBT k1; memset(&k1, 0, sizeof k1);
DBT v1; memset(&v1, 0, sizeof v1);
r = cursor[1]->c_get(cursor[1], &k1, &v1, DB_FIRST); assert(r == 0);
if (verbose) {
printf("k1:%p:%d\n", k1.data, k1.size);
printf("v1:%p:%d\n", v1.data, v1.size);
printf("k1:%p:%u\n", k1.data, k1.size);
printf("v1:%p:%u\n", v1.data, v1.size);
}
r = cursor[0]->c_get(cursor[0], &k0, &v0, DB_NEXT); assert(r == 0);
if (verbose) {
printf("k0:%p:%d\n", k0.data, k0.size);
printf("v0:%p:%d\n", v0.data, v0.size);
printf("k0:%p:%u\n", k0.data, k0.size);
printf("v0:%p:%u\n", v0.data, v0.size);
}
assert(k0.data != k1.data);
......
......@@ -15,7 +15,8 @@
#include "test.h"
void verify_distinct_pointers (void **ptrs, int n) {
static void
verify_distinct_pointers (void **ptrs, int n) {
int i,j;
for (i=0; i<n; i++) {
for (j=i+1; j<n; j++) {
......@@ -31,7 +32,8 @@ DB_TXN * const null_txn = 0;
enum { ncursors = 2 };
DBC *cursor[ncursors];
void testit (u_int32_t cop) {
static void
testit (u_int32_t cop) {
void *kptrs[ncursors];
void *vptrs[ncursors];
int i;
......@@ -47,7 +49,8 @@ void testit (u_int32_t cop) {
verify_distinct_pointers(vptrs, ncursors);
}
void test(void) {
static void
test (void) {
if (verbose) printf("test_cursor\n");
const char * const fname = "test.cursor.brt";
......
......@@ -119,10 +119,10 @@ static void test_skip_key(u_int32_t dup_flags, u_int32_t flag, BOOL is_next) {
int forward = is_next ? 1 : -1;
insert(key, data);
insert(key + forward, data);
insert((char)(key + forward), data);
c_get(flag, key, data);
insert(key, data + forward);
c_get(flag, key + forward, data);
insert(key, (char)(data + forward));
c_get(flag, (char)(key + forward), data);
/* ********************************************************************** */
close_cursor();
......@@ -135,15 +135,15 @@ static void test_do_not_skip_key(u_int32_t dup_flags, u_int32_t flag, BOOL is_ne
setup_db(dup_flags);
setup_cursor();
char key = 'g';
char data = 'g';
char key = 'g';
char data = 'g';
int forward = is_next ? 1 : -1;
insert(key, data);
insert(key + forward, data);
insert((char)(key + forward), data);
c_get(flag, key, data);
insert(key, data + forward);
c_get(flag, key, data + forward);
insert(key, (char)(data + forward));
c_get(flag, key, (char)(data + forward));
close_cursor();
close_db();
......@@ -151,7 +151,7 @@ static void test_do_not_skip_key(u_int32_t dup_flags, u_int32_t flag, BOOL is_ne
}
static void run_test(u_int32_t dup_flags) {
dups = dup_flags != 0;
dups = (BOOL)(dup_flags != 0);
/* ********************************************************************** */
/* Test DB_NEXT works properly. */
if (dups) {
......
......@@ -13,14 +13,16 @@
#include "test.h"
void db_put(DB *db, int k, int v) {
static void
db_put (DB *db, int k, int v) {
DB_TXN * const null_txn = 0;
DBT key, val;
int r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
assert(r == 0);
}
void test_cursor_current() {
static void
test_cursor_current (void) {
if (verbose) printf("test_cursor_current\n");
DB_ENV * const null_env = 0;
......@@ -88,13 +90,15 @@ void test_cursor_current() {
r = db->close(db, 0); assert(r == 0);
}
void db_get(DB *db, int k, int UU(v), int expectr) {
static void
db_get (DB *db, int k, int UU(v), int expectr) {
DBT key, val;
int r = db->get(db, 0, dbt_init(&key, &k, sizeof k), dbt_init_malloc(&val), 0);
assert(r == expectr);
}
void test_reopen() {
static void
test_reopen (void) {
if (verbose) printf("test_reopen\n");
DB_ENV * const null_env = 0;
......
......@@ -13,7 +13,8 @@
#include "test.h"
void cursor_expect(DBC *cursor, int k, int v, int op) {
static void
cursor_expect (DBC *cursor, int k, int v, int op) {
DBT key, val;
int r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&val), op);
assert(r == 0);
......@@ -23,7 +24,7 @@ void cursor_expect(DBC *cursor, int k, int v, int op) {
assert(val.size == sizeof v);
int vv;
memcpy(&vv, val.data, val.size);
if (kk != k || vv != v) printf("expect key %d got %d - %d %d\n", htonl(k), htonl(kk), htonl(v), htonl(vv));
if (kk != k || vv != v) printf("expect key %u got %u - %u %u\n", htonl(k), htonl(kk), htonl(v), htonl(vv));
assert(kk == k);
assert(vv == v);
......@@ -31,7 +32,8 @@ void cursor_expect(DBC *cursor, int k, int v, int op) {
free(val.data);
}
void cursor_expect_fail(DBC *cursor, int op, int expectr) {
static void
cursor_expect_fail (DBC *cursor, int op, int expectr) {
DBT key, val;
int r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&val), op);
assert(r == expectr);
......@@ -40,7 +42,8 @@ void cursor_expect_fail(DBC *cursor, int op, int expectr) {
/* generate a multi-level tree and delete all entries with a cursor
verify that the pivot flags are toggled (currently by inspection) */
void test_cursor_delete(int dup_mode) {
static void
test_cursor_delete (int dup_mode) {
if (verbose) printf("test_cursor_delete:%d\n", dup_mode);
int pagesize = 4096;
......@@ -87,7 +90,8 @@ void test_cursor_delete(int dup_mode) {
}
/* insert duplicate duplicates into a sorted duplicate tree */
void test_cursor_delete_dupsort() {
static void
test_cursor_delete_dupsort (void) {
if (verbose) printf("test_cursor_delete_dupsort\n");
int pagesize = 4096;
......@@ -115,14 +119,14 @@ void test_cursor_delete_dupsort() {
int k = htonl(1);
int v = htonl(1);
DBT key, val;
#if USE_BDB
#ifdef USE_BDB
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
if (i == 0)
assert(r == 0);
else
assert(r == DB_KEYEXIST);
#endif
#if USE_TDB
#ifdef USE_TDB
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
assert(r == EINVAL);
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), DB_YESOVERWRITE);
......@@ -153,7 +157,7 @@ int main(int argc, const char *argv[]) {
mkdir(ENVDIR, 0777);
test_cursor_delete(0);
#if USE_BDB
#ifdef USE_BDB
test_cursor_delete(DB_DUP);
#endif
test_cursor_delete(DB_DUP + DB_DUPSORT);
......
......@@ -17,7 +17,8 @@ static DB_ENV *dbenv;
static DB *db;
static DB_TXN * txn;
void test_cursor_delete2 () {
static void
test_cursor_delete2 (void) {
int r;
DBT key,val;
......
......@@ -18,7 +18,8 @@ static DB *db;
static DB_TXN * txn;
static DBC *cursor;
void test_cursor_delete2 () {
static void
test_cursor_delete2 (void) {
int r;
DBT key,val;
......
......@@ -15,7 +15,8 @@
#define ENVDIR "./test.dir"
#endif
void walk(DB *db) {
static void
walk (DB *db) {
int r;
DB_TXN * const null_txn = 0;
......@@ -29,7 +30,7 @@ void walk(DB *db) {
r = cursor->c_get(cursor, &key, &val, DB_NEXT);
if (r != 0)
break;
if (verbose) printf("%d %d %d\n", i, key.size, val.size);
if (verbose) printf("%d %u %u\n", i, key.size, val.size);
if (i == 0) assert(key.size == 0);
}
assert(i != 0);
......@@ -39,7 +40,8 @@ void walk(DB *db) {
if (val.data) free(val.data);
}
void test_insert_zero_length(int n, int dup_mode, const char *dbname) {
static void
test_insert_zero_length (int n, int dup_mode, const char *dbname) {
if (verbose) printf("test_insert_zero_length:%d %d\n", n, dup_mode);
DB_ENV * const null_env = 0;
......@@ -95,7 +97,8 @@ void test_insert_zero_length(int n, int dup_mode, const char *dbname) {
r = db->close(db, 0); assert(r == 0);
}
void test_insert_zero_length_keys(int n, int dup_mode, const char *dbname) {
static void
test_insert_zero_length_keys (int n, int dup_mode, const char *dbname) {
if (verbose) printf("test_insert_zero_length_keys:%d %d\n", n, dup_mode);
DB_ENV * const null_env = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment