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/avl.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 /avl.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 'avl.h')
-rw-r--r--avl.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/avl.h b/avl.h
index c468597..1eb18ad 100644
--- a/avl.h
+++ b/avl.h
@@ -238,7 +238,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* NULL if no element was found
*/
#define avl_find_element(tree, key, element, node_element) \
- ((typeof(*(element)) *)__avl_find_element(tree, key, offsetof(typeof(*(element)), node_element), AVL_FIND_EQUAL))
+ ((__typeof__(*(element)) *)__avl_find_element(tree, key, offsetof(typeof(*(element)), node_element), AVL_FIND_EQUAL))
/**
* @param tree pointer to avl-tree
@@ -251,7 +251,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* NULL if no element was found
*/
#define avl_find_le_element(tree, key, element, node_element) \
- ((typeof(*(element)) *)__avl_find_element(tree, key, offsetof(typeof(*(element)), node_element), AVL_FIND_LESSEQUAL))
+ ((__typeof__(*(element)) *)__avl_find_element(tree, key, offsetof(typeof(*(element)), node_element), AVL_FIND_LESSEQUAL))
/**
* @param tree pointer to avl-tree
@@ -264,7 +264,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* NULL if no element was found
*/
#define avl_find_ge_element(tree, key, element, node_element) \
- ((typeof(*(element)) *)__avl_find_element(tree, key, offsetof(typeof(*(element)), node_element), AVL_FIND_GREATEREQUAL))
+ ((__typeof__(*(element)) *)__avl_find_element(tree, key, offsetof(typeof(*(element)), node_element), AVL_FIND_GREATEREQUAL))
/**
* This function must not be called for an empty tree
@@ -278,7 +278,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* (automatically converted to type 'element')
*/
#define avl_first_element(tree, element, node_member) \
- container_of((tree)->list_head.next, typeof(*(element)), node_member.list)
+ container_of((tree)->list_head.next, __typeof__(*(element)), node_member.list)
/**
* @param tree pointer to tree
@@ -290,7 +290,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* (automatically converted to type 'element')
*/
#define avl_last_element(tree, element, node_member) \
- container_of((tree)->list_head.prev, typeof(*(element)), node_member.list)
+ container_of((tree)->list_head.prev, __typeof__(*(element)), node_member.list)
/**
* This function must not be called for the last element of
@@ -303,7 +303,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* (automatically converted to type 'element')
*/
#define avl_next_element(element, node_member) \
- container_of((&(element)->node_member.list)->next, typeof(*(element)), node_member.list)
+ container_of((&(element)->node_member.list)->next, __typeof__(*(element)), node_member.list)
/**
* This function must not be called for the first element of
@@ -316,7 +316,7 @@ __avl_find_element(const struct avl_tree *tree, const void *key, size_t offset,
* (automatically converted to type 'element')
*/
#define avl_prev_element(element, node_member) \
- container_of((&(element)->node_member.list)->prev, typeof(*(element)), node_member.list)
+ container_of((&(element)->node_member.list)->prev, __typeof__(*(element)), node_member.list)
/**
* Loop over a block of elements of a tree, used similar to a for() command.