Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
da11a6d9
Commit
da11a6d9
authored
Jul 15, 2005
by
Michael Beck
Browse files
removed C99 features
typos fixed [r6234]
parent
9a2601dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/adt/plist.c
View file @
da11a6d9
...
...
@@ -28,7 +28,7 @@ struct PListElement {
*/
struct
PList
{
/**
* The ob
a
stack used for all allocations.
* The obstack used for all allocations.
*/
struct
obstack
obst
;
/**
...
...
@@ -40,7 +40,7 @@ struct PList {
*/
PListElement
*
lastElement
;
/**
* Current num
n
er of elements in the list.
* Current num
b
er of elements in the list.
*/
int
elementCount
;
/**
...
...
@@ -56,7 +56,7 @@ struct PList {
* fetching one from the free-list or allocating a new one on the lists
* obstack.
* @param list the list for which to allocate the element.
* @return the newlyallocated, uninitialized element.
* @return the newly
allocated, uninitialized element.
*/
static
PListElement
*
allocate_element
(
PList
*
list
)
{
PListElement
*
newElement
;
...
...
@@ -116,10 +116,12 @@ void plist_insert_front(PList* list, void* value) {
}
void
plist_insert_before
(
PList
*
list
,
PListElement
*
element
,
void
*
value
)
{
PListElement
*
prevElement
;
PListElement
*
newElement
=
allocate_element
(
list
);
newElement
->
data
=
value
;
newElement
->
next
=
element
;
PListElement
*
prevElement
=
element
->
prev
;
prevElement
=
element
->
prev
;
newElement
->
prev
=
prevElement
;
if
(
prevElement
!=
NULL
)
{
prevElement
->
next
=
newElement
;
...
...
@@ -131,10 +133,12 @@ void plist_insert_before(PList* list, PListElement* element, void* value) {
}
void
plist_insert_after
(
PList
*
list
,
PListElement
*
element
,
void
*
value
)
{
PListElement
*
nextElement
;
PListElement
*
newElement
=
allocate_element
(
list
);
newElement
->
data
=
value
;
newElement
->
prev
=
element
;
PListElement
*
nextElement
=
element
->
next
;
nextElement
=
element
->
next
;
newElement
->
next
=
nextElement
;
if
(
nextElement
!=
NULL
)
{
nextElement
->
prev
=
newElement
;
...
...
@@ -160,7 +164,7 @@ void plist_erase(PList* list, PListElement* element) {
}
--
list
->
elementCount
;
/* Clean the element and prepend it to the free list */
element
->
prev
=
NULL
;
/* The allocation code exp
r
ects prev to be NULL */
element
->
prev
=
NULL
;
/* The allocation code expects prev to be NULL */
element
->
next
=
list
->
firstFreeElement
;
list
->
firstFreeElement
=
element
;
}
...
...
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