Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b898d248
Commit
b898d248
authored
Feb 01, 2008
by
Yoni Fogel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced unsigned with u_int32_t
git-svn-id:
file:///svn/tokudb@2034
c7de825b-a66e-492c-adef-691d508d4ae1
parent
c8e5ebee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
src/range_tree/linear.c
src/range_tree/linear.c
+16
-16
src/range_tree/rangetree.h
src/range_tree/rangetree.h
+4
-4
No files found.
src/range_tree/linear.c
View file @
b898d248
...
...
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
const
u
nsigned
minlen
=
64
;
const
u
_int32_t
minlen
=
64
;
/*
* Returns:
...
...
@@ -32,12 +32,12 @@ static int __toku_rt_p_cmp(toku_range_tree* tree,
return
0
;
}
static
int
__toku_rt_decrease_capacity
(
toku_range_tree
*
tree
,
u
nsigned
_num
)
{
static
int
__toku_rt_decrease_capacity
(
toku_range_tree
*
tree
,
u
_int32_t
_num
)
{
assert
(
tree
);
u
nsigned
num
=
_num
<
minlen
?
minlen
:
_num
;
u
_int32_t
num
=
_num
<
minlen
?
minlen
:
_num
;
if
(
tree
->
ranges_len
>=
num
*
2
)
{
u
nsigned
temp_len
=
tree
->
ranges_len
;
u
_int32_t
temp_len
=
tree
->
ranges_len
;
while
(
temp_len
>=
num
*
2
)
temp_len
/=
2
;
assert
(
temp_len
>=
_num
);
//Sanity check.
toku_range
*
temp_ranges
=
...
...
@@ -49,10 +49,10 @@ static int __toku_rt_decrease_capacity(toku_range_tree* tree, unsigned _num) {
return
0
;
}
static
int
__toku_rt_increase_capacity
(
toku_range_tree
*
tree
,
u
nsigned
num
)
{
static
int
__toku_rt_increase_capacity
(
toku_range_tree
*
tree
,
u
_int32_t
num
)
{
assert
(
tree
);
if
(
tree
->
ranges_len
<
num
)
{
u
nsigned
temp_len
=
tree
->
ranges_len
;
u
_int32_t
temp_len
=
tree
->
ranges_len
;
while
(
temp_len
<
num
)
temp_len
*=
2
;
toku_range
*
temp_ranges
=
tree
->
realloc
(
tree
->
ranges
,
temp_len
*
sizeof
(
toku_range
));
...
...
@@ -64,11 +64,11 @@ static int __toku_rt_increase_capacity(toku_range_tree* tree, unsigned num) {
}
static
int
__toku_rt_increase_buffer
(
toku_range_tree
*
tree
,
toku_range
**
buf
,
u
nsigned
*
buflen
,
unsigned
num
)
{
u
_int32_t
*
buflen
,
u_int32_t
num
)
{
assert
(
buf
);
assert
(
buflen
);
if
(
*
buflen
<
num
)
{
u
nsigned
temp_len
=
*
buflen
;
u
_int32_t
temp_len
=
*
buflen
;
while
(
temp_len
<
num
)
temp_len
*=
2
;
toku_range
*
temp_buf
=
tree
->
realloc
(
*
buf
,
temp_len
*
sizeof
(
toku_range
));
...
...
@@ -146,15 +146,15 @@ int toku_rt_close(toku_range_tree* tree) {
return
0
;
}
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
nsigned
k
,
toku_range
**
buf
,
u
nsigned
*
buflen
,
unsigned
*
numfound
)
{
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
_int32_t
k
,
toku_range
**
buf
,
u
_int32_t
*
buflen
,
u_int32_t
*
numfound
)
{
if
(
!
tree
||
!
query
||
!
buf
||
!
buflen
||
!
numfound
)
return
EINVAL
;
if
(
query
->
data
!=
NULL
)
return
EINVAL
;
if
(
*
buflen
==
0
)
return
EINVAL
;
u
nsigned
temp_numfound
=
0
;
u
_int32_t
temp_numfound
=
0
;
int
r
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
if
(
__toku_rt_overlap
(
tree
,
query
,
&
tree
->
ranges
[
i
]))
{
...
...
@@ -172,7 +172,7 @@ int toku_rt_find(toku_range_tree* tree, toku_range* query, unsigned k,
int
toku_rt_insert
(
toku_range_tree
*
tree
,
toku_range
*
range
)
{
if
(
!
tree
||
!
range
)
return
EINVAL
;
u
nsigned
i
;
u
_int32_t
i
;
int
r
;
//EDOM cases
...
...
@@ -194,7 +194,7 @@ int toku_rt_insert(toku_range_tree* tree, toku_range* range) {
int
toku_rt_delete
(
toku_range_tree
*
tree
,
toku_range
*
range
)
{
if
(
!
tree
||
!
range
)
return
EINVAL
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
&&
...
...
@@ -214,7 +214,7 @@ int toku_rt_predecessor (toku_range_tree* tree, void* point, toku_range* pred,
if
(
!
tree
||
!
point
||
!
pred
||
!
wasfound
)
return
EINVAL
;
if
(
tree
->
allow_overlaps
)
return
EINVAL
;
toku_range
*
best
=
NULL
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
if
(
__toku_rt_p_cmp
(
tree
,
point
,
&
tree
->
ranges
[
i
])
>
0
&&
...
...
@@ -232,7 +232,7 @@ int toku_rt_successor (toku_range_tree* tree, void* point, toku_range* succ,
if
(
!
tree
||
!
point
||
!
succ
||
!
wasfound
)
return
EINVAL
;
if
(
tree
->
allow_overlaps
)
return
EINVAL
;
toku_range
*
best
=
NULL
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
if
(
__toku_rt_p_cmp
(
tree
,
point
,
&
tree
->
ranges
[
i
])
<
0
&&
...
...
src/range_tree/rangetree.h
View file @
b898d248
...
...
@@ -44,7 +44,7 @@ struct __toku_range_tree_internal {
/** Whether this tree allows ranges to overlap */
BOOL
allow_overlaps
;
/** The number of ranges in the range tree */
u
nsigned
numelements
;
u
_int32_t
numelements
;
/** The user malloc function */
void
*
(
*
malloc
)
(
size_t
);
/** The user free function */
...
...
@@ -57,7 +57,7 @@ struct __toku_range_tree_internal {
#endif
//Linear version only fields:
toku_range
*
ranges
;
u
nsigned
ranges_len
;
u
_int32_t
ranges_len
;
#elif defined(TOKU_LOG_RANGE_TREE)
#error Not defined yet.
//Log version only fields:
...
...
@@ -145,8 +145,8 @@ int toku_rt_close(toku_range_tree* tree /**< The range tree to free */);
parameter to specify whether more elements exist in the tree that overlap
(in excess of the requested limit of k).
*/
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
nsigned
k
,
toku_range
**
buf
,
u
nsigned
*
buflen
,
unsigned
*
numfound
);
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
_int32_t
k
,
toku_range
**
buf
,
u
_int32_t
*
buflen
,
u_int32_t
*
numfound
);
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment