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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
11ffe009
Commit
11ffe009
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
ecf22e0f
Changes
2
Hide 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 @
11ffe009
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
const
u
nsigned
minlen
=
64
;
const
u
_int32_t
minlen
=
64
;
/*
/*
* Returns:
* Returns:
...
@@ -32,12 +32,12 @@ static int __toku_rt_p_cmp(toku_range_tree* tree,
...
@@ -32,12 +32,12 @@ static int __toku_rt_p_cmp(toku_range_tree* tree,
return
0
;
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
);
assert
(
tree
);
u
nsigned
num
=
_num
<
minlen
?
minlen
:
_num
;
u
_int32_t
num
=
_num
<
minlen
?
minlen
:
_num
;
if
(
tree
->
ranges_len
>=
num
*
2
)
{
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
;
while
(
temp_len
>=
num
*
2
)
temp_len
/=
2
;
assert
(
temp_len
>=
_num
);
//Sanity check.
assert
(
temp_len
>=
_num
);
//Sanity check.
toku_range
*
temp_ranges
=
toku_range
*
temp_ranges
=
...
@@ -49,10 +49,10 @@ static int __toku_rt_decrease_capacity(toku_range_tree* tree, unsigned _num) {
...
@@ -49,10 +49,10 @@ static int __toku_rt_decrease_capacity(toku_range_tree* tree, unsigned _num) {
return
0
;
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
);
assert
(
tree
);
if
(
tree
->
ranges_len
<
num
)
{
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
;
while
(
temp_len
<
num
)
temp_len
*=
2
;
toku_range
*
temp_ranges
=
toku_range
*
temp_ranges
=
tree
->
realloc
(
tree
->
ranges
,
temp_len
*
sizeof
(
toku_range
));
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) {
...
@@ -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
,
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
(
buf
);
assert
(
buflen
);
assert
(
buflen
);
if
(
*
buflen
<
num
)
{
if
(
*
buflen
<
num
)
{
u
nsigned
temp_len
=
*
buflen
;
u
_int32_t
temp_len
=
*
buflen
;
while
(
temp_len
<
num
)
temp_len
*=
2
;
while
(
temp_len
<
num
)
temp_len
*=
2
;
toku_range
*
temp_buf
=
toku_range
*
temp_buf
=
tree
->
realloc
(
*
buf
,
temp_len
*
sizeof
(
toku_range
));
tree
->
realloc
(
*
buf
,
temp_len
*
sizeof
(
toku_range
));
...
@@ -146,15 +146,15 @@ int toku_rt_close(toku_range_tree* tree) {
...
@@ -146,15 +146,15 @@ int toku_rt_close(toku_range_tree* tree) {
return
0
;
return
0
;
}
}
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
nsigned
k
,
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
_int32_t
k
,
toku_range
**
buf
,
u
nsigned
*
buflen
,
unsigned
*
numfound
)
{
toku_range
**
buf
,
u
_int32_t
*
buflen
,
u_int32_t
*
numfound
)
{
if
(
!
tree
||
!
query
||
!
buf
||
!
buflen
||
!
numfound
)
return
EINVAL
;
if
(
!
tree
||
!
query
||
!
buf
||
!
buflen
||
!
numfound
)
return
EINVAL
;
if
(
query
->
data
!=
NULL
)
return
EINVAL
;
if
(
query
->
data
!=
NULL
)
return
EINVAL
;
if
(
*
buflen
==
0
)
return
EINVAL
;
if
(
*
buflen
==
0
)
return
EINVAL
;
u
nsigned
temp_numfound
=
0
;
u
_int32_t
temp_numfound
=
0
;
int
r
;
int
r
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
if
(
__toku_rt_overlap
(
tree
,
query
,
&
tree
->
ranges
[
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,
...
@@ -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
)
{
int
toku_rt_insert
(
toku_range_tree
*
tree
,
toku_range
*
range
)
{
if
(
!
tree
||
!
range
)
return
EINVAL
;
if
(
!
tree
||
!
range
)
return
EINVAL
;
u
nsigned
i
;
u
_int32_t
i
;
int
r
;
int
r
;
//EDOM cases
//EDOM cases
...
@@ -194,7 +194,7 @@ int toku_rt_insert(toku_range_tree* tree, toku_range* range) {
...
@@ -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
)
{
int
toku_rt_delete
(
toku_range_tree
*
tree
,
toku_range
*
range
)
{
if
(
!
tree
||
!
range
)
return
EINVAL
;
if
(
!
tree
||
!
range
)
return
EINVAL
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
for
(
i
=
0
;
i
<
tree
->
numelements
&&
i
<
tree
->
numelements
&&
...
@@ -214,7 +214,7 @@ int toku_rt_predecessor (toku_range_tree* tree, void* point, toku_range* pred,
...
@@ -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
||
!
point
||
!
pred
||
!
wasfound
)
return
EINVAL
;
if
(
tree
->
allow_overlaps
)
return
EINVAL
;
if
(
tree
->
allow_overlaps
)
return
EINVAL
;
toku_range
*
best
=
NULL
;
toku_range
*
best
=
NULL
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
if
(
__toku_rt_p_cmp
(
tree
,
point
,
&
tree
->
ranges
[
i
])
>
0
&&
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,
...
@@ -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
||
!
point
||
!
succ
||
!
wasfound
)
return
EINVAL
;
if
(
tree
->
allow_overlaps
)
return
EINVAL
;
if
(
tree
->
allow_overlaps
)
return
EINVAL
;
toku_range
*
best
=
NULL
;
toku_range
*
best
=
NULL
;
u
nsigned
i
;
u
_int32_t
i
;
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
for
(
i
=
0
;
i
<
tree
->
numelements
;
i
++
)
{
if
(
__toku_rt_p_cmp
(
tree
,
point
,
&
tree
->
ranges
[
i
])
<
0
&&
if
(
__toku_rt_p_cmp
(
tree
,
point
,
&
tree
->
ranges
[
i
])
<
0
&&
...
...
src/range_tree/rangetree.h
View file @
11ffe009
...
@@ -44,7 +44,7 @@ struct __toku_range_tree_internal {
...
@@ -44,7 +44,7 @@ struct __toku_range_tree_internal {
/** Whether this tree allows ranges to overlap */
/** Whether this tree allows ranges to overlap */
BOOL
allow_overlaps
;
BOOL
allow_overlaps
;
/** The number of ranges in the range tree */
/** The number of ranges in the range tree */
u
nsigned
numelements
;
u
_int32_t
numelements
;
/** The user malloc function */
/** The user malloc function */
void
*
(
*
malloc
)
(
size_t
);
void
*
(
*
malloc
)
(
size_t
);
/** The user free function */
/** The user free function */
...
@@ -57,7 +57,7 @@ struct __toku_range_tree_internal {
...
@@ -57,7 +57,7 @@ struct __toku_range_tree_internal {
#endif
#endif
//Linear version only fields:
//Linear version only fields:
toku_range
*
ranges
;
toku_range
*
ranges
;
u
nsigned
ranges_len
;
u
_int32_t
ranges_len
;
#elif defined(TOKU_LOG_RANGE_TREE)
#elif defined(TOKU_LOG_RANGE_TREE)
#error Not defined yet.
#error Not defined yet.
//Log version only fields:
//Log version only fields:
...
@@ -145,8 +145,8 @@ int toku_rt_close(toku_range_tree* tree /**< The range tree to free */);
...
@@ -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
parameter to specify whether more elements exist in the tree that overlap
(in excess of the requested limit of k).
(in excess of the requested limit of k).
*/
*/
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
nsigned
k
,
int
toku_rt_find
(
toku_range_tree
*
tree
,
toku_range
*
query
,
u
_int32_t
k
,
toku_range
**
buf
,
u
nsigned
*
buflen
,
unsigned
*
numfound
);
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