aboutsummaryrefslogtreecommitdiff
path: root/include/shared/linked_list.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/shared/linked_list.h')
-rw-r--r--include/shared/linked_list.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/shared/linked_list.h b/include/shared/linked_list.h
index 17c2cdd..3f8e075 100644
--- a/include/shared/linked_list.h
+++ b/include/shared/linked_list.h
@@ -10,17 +10,17 @@
#define linked_list_front(type) linked_list_front_##type
#define linked_list_back(type) linked_list_back_##type
#define linked_list_length(type) linked_list_length_##type
-#define linked_list_length(type) linked_list_length_##type
#define LINKED_LIST_INIT \
{ \
.head = NULL \
}
-#define linked_list_foreach(ll, val) \
- for (typeof(ll.head) _cur_ = ll.head, typeof(_cur_->value) val; \
- _cur_ != NULL && ((val = _cur_->value) || 1); \
- _cur_ = _cur_->next)
+#define linked_list_foreach(ll, val) \
+ typeof(ll.head) _cur_ = ll.head; \
+ typeof(_cur_->value) val; \
+ if (_cur_) val = _cur_->value; \
+ for (; _cur_ != NULL; _cur_ = _cur_->next, val = _cur_ ? _cur_->value : val)
#define NO_ATTRIBUTE