Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
ad52f854
Commit
ad52f854
authored
May 04, 2012
by
Alejandro Mery
Browse files
sunxi-tools.h: add list_next() and list_remove() helpers
parent
f2ff0fc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
sunxi-tools.h
View file @
ad52f854
...
...
@@ -47,7 +47,7 @@ static inline void list_init(struct list_entry *self)
self
->
prev
=
self
->
next
=
self
;
}
/** append a list hook @l1 at the end of the list @l0 */
/** append
s
a list hook @l1 at the end of the list @l0 */
static
inline
void
list_append
(
struct
list_entry
*
l0
,
struct
list_entry
*
l1
)
{
l1
->
next
=
l0
;
...
...
@@ -55,12 +55,26 @@ static inline void list_append(struct list_entry *l0, struct list_entry *l1)
l0
->
prev
=
l1
;
}
/** returns list element of a list */
/** removes an entry for the list where it's contained */
static
inline
void
list_remove
(
struct
list_entry
*
l
)
{
struct
list_entry
*
prev
=
l
->
prev
,
*
next
=
l
->
next
;
next
->
prev
=
prev
;
prev
->
next
=
next
;
}
/** returns last element of a list */
static
inline
struct
list_entry
*
list_last
(
struct
list_entry
*
l
)
{
return
(
l
->
prev
==
l
)
?
NULL
:
l
->
prev
;
}
/** returns first element of a list */
static
inline
struct
list_entry
*
list_next
(
struct
list_entry
*
l
)
{
return
(
l
->
next
==
l
)
?
NULL
:
l
->
next
;
}
/** is list empty? */
static
inline
int
list_empty
(
struct
list_entry
*
l
)
{
...
...
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