TB print hello world

This commit is contained in:
2025-09-14 23:31:14 +02:00
parent 062e98d714
commit 40ccb7d476
6 changed files with 322 additions and 0 deletions

45
ulib/linklist.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef ULIB_LINKLIST_H_
#define ULIB_LINKLIST_H_
#define LL_APPEND(head, new) \
do { \
if ((head) != NULL) { \
typeof((head)) __tmp; \
(new)->next = NULL; \
__tmp = (head); \
while (__tmp->next != NULL) { \
__tmp = __tmp->next; \
} \
__tmp->next = (new); \
} else { \
(new)->next = NULL; \
(head) = (new); \
} \
} while(0)
#define LL_REMOVE(head, ele) \
do { \
typeof((head)) __cur = (head); \
typeof((head)) __prev = NULL; \
while (__cur != (ele)) { \
__prev = __cur; \
__cur = __cur->next; \
} \
if (__prev != NULL) { \
__prev->next = __cur->next; \
} \
} while(0)
#define LL_FINDPROP(head, out, propname, propvalue) \
do { \
typeof((head)) __tmp = (head); \
while (__tmp) { \
if (__tmp->propname == (propvalue)) { \
(out) = __tmp; \
break; \
} \
__tmp = __tmp->next; \
} \
} while(0)
#endif // ULIB_LINKLIST_H_