Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/list.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2018-04-07 16:21:25 +0300
committerRafał Miłecki <rafal@milecki.pl>2018-11-16 19:10:20 +0300
commit4382c76d1f225e462c6adf37e577fea0d046b854 (patch)
treea805015bc27c4beae41e373aba78a6b9f04a8b35 /list.h
parent1dafcd7813f147811a6bbdb00eec603fe732aac1 (diff)
switch from typeof to the more portable __typeof__lede-17.01
Depending on the existance/lack of container_of define including libubox or uci headers (e.g. #include <uci.h>) could result in compilation errors like: staging_dir/target-arm_cortex-a9_musl-1.1.16_eabi/usr/include/uci.h:643:10: error: expected declaration specifiers or '...' before '(' token return uci_to_package(e); staging_dir/target-arm_cortex-a9_musl-1.1.16_eabi/usr/include/uci.h:643:10: error: '__mptr' undeclared (first use in this function) return uci_to_package(e); Signed-off-by: Felix Fietkau <nbd@nbd.name> [rmilecki: add commit description] Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit ace64897d47b9bc7af277d8a3f8a0ff67976cba8)
Diffstat (limited to 'list.h')
-rw-r--r--list.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/list.h b/list.h
index ab52acf..8e61e47 100644
--- a/list.h
+++ b/list.h
@@ -37,7 +37,7 @@
#ifndef container_of
#define container_of(ptr, type, member) \
({ \
- const typeof(((type *) NULL)->member) *__mptr = (ptr); \
+ const __typeof__(((type *) NULL)->member) *__mptr = (ptr); \
(type *) ((char *) __mptr - offsetof(type, member)); \
})
#endif
@@ -120,17 +120,17 @@ list_del_init(struct list_head *entry)
for (p = (head)->next, n = p->next; p != (head); p = n, n = p->next)
#define list_for_each_entry(p, h, field) \
- for (p = list_first_entry(h, typeof(*p), field); &p->field != (h); \
- p = list_entry(p->field.next, typeof(*p), field))
+ for (p = list_first_entry(h, __typeof__(*p), field); &p->field != (h); \
+ p = list_entry(p->field.next, __typeof__(*p), field))
#define list_for_each_entry_safe(p, n, h, field) \
- for (p = list_first_entry(h, typeof(*p), field), \
- n = list_entry(p->field.next, typeof(*p), field); &p->field != (h);\
- p = n, n = list_entry(n->field.next, typeof(*n), field))
+ for (p = list_first_entry(h, __typeof__(*p), field), \
+ n = list_entry(p->field.next, __typeof__(*p), field); &p->field != (h);\
+ p = n, n = list_entry(n->field.next, __typeof__(*n), field))
#define list_for_each_entry_reverse(p, h, field) \
- for (p = list_last_entry(h, typeof(*p), field); &p->field != (h); \
- p = list_entry(p->field.prev, typeof(*p), field))
+ for (p = list_last_entry(h, __typeof__(*p), field); &p->field != (h); \
+ p = list_entry(p->field.prev, __typeof__(*p), field))
#define list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = p->prev)
#define list_for_each_prev_safe(p, n, h) for (p = (h)->prev, n = p->prev; p != (h); p = n, n = p->prev)