Commit fe34a44f authored by Yoni Fogel's avatar Yoni Fogel

Makefiles ported to OSX,
Fixed non-standard calling convention for toku_rt_get_size

git-svn-id: file:///svn/tokudb@2551 c7de825b-a66e-492c-adef-691d508d4ae1
parent b916b668
......@@ -8,9 +8,10 @@ VISIBILITY = -fvisibility=hidden
OPTFLAGS = -O2
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS = -W -Wall -Werror -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS) $(VISIBILITY)
CFLAGS = -W -Wall -Werror -g3 -ggdb3 -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CPPFLAGS = -I../include -I../newbrt -I./lock_tree/ -I./range_tree/
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS+= $(VISIBILITY)
ifneq ($(OSX),)
......
......@@ -14,11 +14,11 @@ else
endif
VISIBILITY = -fvisibility=hidden
EXPORTMAP = -Wl,--version-script=export.map
CFLAGS = -W -Wall -Wextra -Werror -fPIC $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CFLAGS += $(VISIBILITY)
CPPFLAGS = -I. -I.. -I../range_tree -I../../include -I../../newbrt -L../range_tree
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
......@@ -28,8 +28,9 @@ LIBEXT=dylib
SHARED=-dynamiclib
CFLAGS+=-fno-common
else
CFLAGS += $(VISIBILITY)
LIBEXT=so
SHARED=-shared
SHARED=-shared $(EXPORTMAP)
endif
.PHONY: install logformat range_tree
......
{
global:
toku_rt_get_allow_overlaps;
toku_rt_create;
toku_rt_close;
toku_rt_find;
toku_rt_insert;
toku_rt_delete;
toku_rt_predecessor;
toku_rt_successor;
toku_rt_get_size;
local: *;
};
......@@ -1226,13 +1226,19 @@ int toku_lt_unlock(toku_lock_tree* tree, DB_TXN* txn) {
u_int32_t ranges = 0;
if (selfread) {
ranges = toku_rt_get_size(selfread);
u_int32_t size;
r = toku_rt_get_size(selfread, &size);
assert(r==0);
ranges += size;
r = __toku_lt_free_contents(tree, selfread, tree->mainread);
if (r!=0) return __toku_lt_panic(tree, r);
}
if (selfwrite) {
ranges += toku_rt_get_size(selfwrite);
u_int32_t size;
r = toku_rt_get_size(selfwrite, &size);
assert(r==0);
ranges += size;
r = __toku_lt_border_delete(tree, selfwrite);
if (r!=0) return __toku_lt_panic(tree, r);
r = __toku_lt_free_contents(tree, selfwrite, NULL);
......
......@@ -14,23 +14,23 @@ else
endif
VISIBILITY = -fvisibility=hidden
EXPORTMAP = -Wl,--version-script=export.map
CFLAGS = -W -Wall -Wextra -Werror -fPIC $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute
CFLAGS += $(VISIBILITY)
CPPFLAGS = -I../../include -I../../newbrt
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
ifneq ($(OSX),)
LIBEXT=dylib
SHARED=-dynamiclib
CFLAGS+=-fno-common
else
CFLAGS += $(VISIBILITY)
LIBEXT=so
SHARED=-shared
SHARED=-shared $(EXPORTMAP)
endif
.PHONY: install logformat
......
{
global:
toku_rt_get_allow_overlaps;
toku_rt_create;
toku_rt_close;
toku_rt_find;
toku_rt_insert;
toku_rt_delete;
toku_rt_predecessor;
toku_rt_successor;
toku_rt_get_size;
local: *;
};
......@@ -277,7 +277,8 @@ int toku_rt_get_allow_overlaps(toku_range_tree* tree, BOOL* allowed) {
return 0;
}
u_int32_t toku_rt_get_size(toku_range_tree *rt) {
assert(rt);
return rt->numelements;
int toku_rt_get_size(toku_range_tree* tree, u_int32_t* size) {
if (!tree || !size) return EINVAL;
*size = tree->numelements;
return 0;
}
......@@ -205,6 +205,16 @@ int toku_rt_predecessor(toku_range_tree* tree, toku_point* point,
int toku_rt_successor(toku_range_tree* tree, toku_point* point,
toku_range* succ, BOOL* wasfound);
u_int32_t toku_rt_get_size(toku_range_tree *);
/**
Finds the number of elements in the range tree.
\param tree The range tree.
\param size A buffer to return the the number of elements
in the range tree.
\return
- 0: Success.
- EINVAL: If any pointer argument is NULL.
*/
int toku_rt_get_size(toku_range_tree* tree, u_int32_t* size);
#endif /* #if !defined(TOKU_RANGE_TREE_H) */
......@@ -28,7 +28,8 @@ int main(int argc, const char *argv[]) {
range.right = (toku_point*)&nums[1];
range.data = (DB_TXN*)&letters[0];
r = toku_rt_insert(tree, &range); CKERR(r);
u_int32_t num_in_range = toku_rt_get_size(tree);
u_int32_t num_in_range;
r = toku_rt_get_size(tree, &num_in_range); CKERR(r);
assert(num_in_range == 1);
r = toku_rt_delete(tree, &range); CKERR(r);
......
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