Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
20740d84
Commit
20740d84
authored
Aug 15, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rbtree.h: Use parent pointer instead of stack in wine_rb_postorder.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
256f55e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
28 deletions
+21
-28
rbtree.h
include/wine/rbtree.h
+21
-28
No files found.
include/wine/rbtree.h
View file @
20740d84
...
...
@@ -59,8 +59,6 @@ typedef void (wine_rb_traverse_func_t)(struct wine_rb_entry *entry, void *contex
#define WINE_RB_FLAG_RED 0x1
#define WINE_RB_FLAG_STOP 0x2
#define WINE_RB_FLAG_TRAVERSED_LEFT 0x4
#define WINE_RB_FLAG_TRAVERSED_RIGHT 0x8
static
inline
void
wine_rb_stack_clear
(
struct
wine_rb_stack
*
stack
)
{
...
...
@@ -185,37 +183,32 @@ static inline void wine_rb_move_red_right(struct wine_rb_tree *tree, struct wine
}
}
static
inline
void
wine_rb_postorder
(
struct
wine_rb_tree
*
tree
,
wine_rb_traverse_func_t
*
callback
,
void
*
context
)
static
inline
struct
wine_rb_entry
*
wine_rb_postorder_head
(
struct
wine_rb_entry
*
iter
)
{
struct
wine_rb_entry
**
entry
;
if
(
!
tree
->
root
)
return
;
if
(
!
iter
)
return
NULL
;
for
(
entry
=
&
tree
->
root
;;)
{
struct
wine_rb_entry
*
e
=
*
entry
;
if
(
e
->
left
&&
!
(
e
->
flags
&
WINE_RB_FLAG_TRAVERSED_LEFT
))
{
wine_rb_stack_push
(
&
tree
->
stack
,
entry
);
e
->
flags
|=
WINE_RB_FLAG_TRAVERSED_LEFT
;
entry
=
&
e
->
left
;
continue
;
}
for
(;;)
{
while
(
iter
->
left
)
iter
=
iter
->
left
;
if
(
!
iter
->
right
)
return
iter
;
iter
=
iter
->
right
;
}
}
if
(
e
->
right
&&
!
(
e
->
flags
&
WINE_RB_FLAG_TRAVERSED_RIGHT
))
{
wine_rb_stack_push
(
&
tree
->
stack
,
entry
);
e
->
flags
|=
WINE_RB_FLAG_TRAVERSED_RIGHT
;
entry
=
&
e
->
right
;
continue
;
}
static
inline
struct
wine_rb_entry
*
wine_rb_postorder_next
(
struct
wine_rb_entry
*
iter
)
{
if
(
!
iter
->
parent
)
return
NULL
;
if
(
iter
==
iter
->
parent
->
right
||
!
iter
->
parent
->
right
)
return
iter
->
parent
;
return
wine_rb_postorder_head
(
iter
->
parent
->
right
);
}
e
->
flags
&=
~
(
WINE_RB_FLAG_TRAVERSED_LEFT
|
WINE_RB_FLAG_TRAVERSED_RIGHT
);
callback
(
e
,
context
);
static
inline
void
wine_rb_postorder
(
struct
wine_rb_tree
*
tree
,
wine_rb_traverse_func_t
*
callback
,
void
*
context
)
{
struct
wine_rb_entry
*
iter
,
*
next
;
if
(
!
tree
->
stack
.
count
)
break
;
entry
=
tree
->
stack
.
entries
[
--
tree
->
stack
.
count
];
for
(
iter
=
wine_rb_postorder_head
(
tree
->
root
);
iter
;
iter
=
next
)
{
next
=
wine_rb_postorder_next
(
iter
);
callback
(
iter
,
context
);
}
}
...
...
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