-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove set arrays and just use a linked list
- Loading branch information
Showing
4 changed files
with
72 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ target_sources( | |
src/endian.c | ||
src/queue.c | ||
src/queue.h | ||
src/link.h | ||
src/io.h | ||
src/udx.c | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef UDX_LINK_H | ||
#define UDX_LINK_H | ||
|
||
#define udx__link_add(l, v) \ | ||
if ((l) == NULL) { \ | ||
(v)->next = (v)->prev = NULL; \ | ||
} else { \ | ||
(v)->prev = NULL; \ | ||
(v)->next = (l); \ | ||
(l)->prev = (v); \ | ||
} \ | ||
(l) = (v); | ||
|
||
#define udx__link_remove(l, v) \ | ||
if ((v) == (l)) { \ | ||
(l) = NULL; \ | ||
} else { \ | ||
if ((v)->next != NULL) (v)->next->prev = (v)->prev; \ | ||
if ((v)->prev != NULL) (v)->prev->next = (v)->next; \ | ||
} | ||
|
||
#define udx__link_foreach(l, el) \ | ||
for ((el) = (l); (el) != NULL; (el) = (el)->next) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters