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
683d777a
Commit
683d777a
authored
Nov 28, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@work.mysql.com:/home/bk/mysql-4.1
into mysql.r18.ru:/usr/home/ram/mysql-4.1
parents
f1b3f48e
57321e64
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
20 deletions
+33
-20
mysys/tree.c
mysys/tree.c
+33
-20
No files found.
mysys/tree.c
View file @
683d777a
...
@@ -335,30 +335,35 @@ void *tree_search_key(TREE *tree, const void *key,
...
@@ -335,30 +335,35 @@ void *tree_search_key(TREE *tree, const void *key,
enum
ha_rkey_function
flag
,
void
*
custom_arg
)
enum
ha_rkey_function
flag
,
void
*
custom_arg
)
{
{
int
cmp
;
int
cmp
;
TREE_ELEMENT
*
element
=
tree
->
root
;
TREE_ELEMENT
*
element
=
tree
->
root
;
TREE_ELEMENT
**
last_left_step_parent
=
NULL
;
TREE_ELEMENT
**
last_left_step_parent
=
NULL
,
**
last_right_step_parent
=
NULL
;
TREE_ELEMENT
**
last_equal_element
=
NULL
;
TREE_ELEMENT
**
last_equal_element
=
NULL
;
/*
/*
TODO: handle HA_READ_KEY_OR_PREV, HA_READ_BEFORE_KEY, HA_READ_PREFIX,
TODO: support for HA_READ_KEY_OR_PREV, HA_READ_PREFIX flags if needed.
HA_READ_PREFIX_LAST flags if needed.
*/
*/
*
parents
=
&
tree
->
null_element
;
*
parents
=
&
tree
->
null_element
;
while
(
element
!=
&
tree
->
null_element
)
while
(
element
!=
&
tree
->
null_element
)
{
{
*++
parents
=
element
;
*++
parents
=
element
;
if
((
cmp
=
(
*
tree
->
compare
)(
custom_arg
,
ELEMENT_KEY
(
tree
,
element
),
if
((
cmp
=
(
*
tree
->
compare
)(
custom_arg
,
ELEMENT_KEY
(
tree
,
element
),
key
))
==
0
)
key
))
==
0
)
{
{
switch
(
flag
)
{
switch
(
flag
)
{
case
HA_READ_KEY_EXACT
:
case
HA_READ_KEY_EXACT
:
case
HA_READ_KEY_OR_NEXT
:
case
HA_READ_KEY_OR_NEXT
:
last_equal_element
=
parents
;
case
HA_READ_BEFORE_KEY
:
cmp
=
1
;
last_equal_element
=
parents
;
cmp
=
1
;
break
;
break
;
case
HA_READ_AFTER_KEY
:
case
HA_READ_AFTER_KEY
:
cmp
=
-
1
;
cmp
=
-
1
;
break
;
case
HA_READ_PREFIX_LAST
:
case
HA_READ_PREFIX_LAST_OR_PREV
:
last_equal_element
=
parents
;
cmp
=
-
1
;
break
;
break
;
default:
default:
return
NULL
;
return
NULL
;
...
@@ -366,23 +371,31 @@ void *tree_search_key(TREE *tree, const void *key,
...
@@ -366,23 +371,31 @@ void *tree_search_key(TREE *tree, const void *key,
}
}
if
(
cmp
<
0
)
/* element < key */
if
(
cmp
<
0
)
/* element < key */
{
{
element
=
element
->
right
;
last_right_step_parent
=
parents
;
element
=
element
->
right
;
}
}
else
else
{
{
last_left_step_parent
=
parents
;
last_left_step_parent
=
parents
;
element
=
element
->
left
;
element
=
element
->
left
;
}
}
}
}
switch
(
flag
)
{
switch
(
flag
)
{
case
HA_READ_KEY_EXACT
:
case
HA_READ_KEY_EXACT
:
*
last_pos
=
last_equal_element
;
case
HA_READ_PREFIX_LAST
:
*
last_pos
=
last_equal_element
;
break
;
break
;
case
HA_READ_KEY_OR_NEXT
:
case
HA_READ_KEY_OR_NEXT
:
*
last_pos
=
last_equal_element
?
last_equal_element
:
last_left_step_parent
;
*
last_pos
=
last_equal_element
?
last_equal_element
:
last_left_step_parent
;
break
;
break
;
case
HA_READ_AFTER_KEY
:
case
HA_READ_AFTER_KEY
:
*
last_pos
=
last_left_step_parent
;
*
last_pos
=
last_left_step_parent
;
break
;
case
HA_READ_PREFIX_LAST_OR_PREV
:
*
last_pos
=
last_equal_element
?
last_equal_element
:
last_right_step_parent
;
break
;
case
HA_READ_BEFORE_KEY
:
*
last_pos
=
last_right_step_parent
;
break
;
break
;
default:
default:
return
NULL
;
return
NULL
;
...
...
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