aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libucl/tree.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-13 17:05:19 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-13 17:05:19 +0100
commitbb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a (patch)
treea6329d843da8a15acf844e4d91101ed2e920f620 /contrib/libucl/tree.h
parent9aac6193c2265ea954fbddd5b3a98ebf0026101f (diff)
downloadrspamd-bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a.tar.gz
rspamd-bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a.zip
Sync with libucl.
Diffstat (limited to 'contrib/libucl/tree.h')
-rw-r--r--contrib/libucl/tree.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/contrib/libucl/tree.h b/contrib/libucl/tree.h
index cee937369..404b4a867 100644
--- a/contrib/libucl/tree.h
+++ b/contrib/libucl/tree.h
@@ -44,6 +44,13 @@
#define TREE_DELTA_MAX 1
+#ifndef _HU_FUNCTION
+# if defined(__GNUC__) || defined(__clang__)
+# define _HU_FUNCTION(x) __attribute__((__unused__)) x
+# else
+# define _HU_FUNCTION(x) x
+# endif
+#endif
#define TREE_ENTRY(type) \
struct { \
@@ -68,9 +75,9 @@
#define TREE_DEFINE(node, field) \
\
- struct node *TREE_BALANCE_##node##_##field(struct node *); \
+ static struct node *_HU_FUNCTION(TREE_BALANCE_##node##_##field)(struct node *); \
\
- struct node *TREE_ROTL_##node##_##field(struct node *self) \
+ static struct node *_HU_FUNCTION(TREE_ROTL_##node##_##field)(struct node *self) \
{ \
struct node *r= self->field.avl_right; \
self->field.avl_right= r->field.avl_left; \
@@ -78,7 +85,7 @@
return TREE_BALANCE_##node##_##field(r); \
} \
\
- struct node *TREE_ROTR_##node##_##field(struct node *self) \
+ static struct node *_HU_FUNCTION(TREE_ROTR_##node##_##field)(struct node *self) \
{ \
struct node *l= self->field.avl_left; \
self->field.avl_left= l->field.avl_right; \
@@ -86,7 +93,7 @@
return TREE_BALANCE_##node##_##field(l); \
} \
\
- struct node *TREE_BALANCE_##node##_##field(struct node *self) \
+ static struct node *_HU_FUNCTION(TREE_BALANCE_##node##_##field)(struct node *self) \
{ \
int delta= TREE_DELTA(self, field); \
\
@@ -111,7 +118,7 @@
return self; \
} \
\
- struct node *TREE_INSERT_##node##_##field \
+ static struct node *_HU_FUNCTION(TREE_INSERT_##node##_##field) \
(struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs)) \
{ \
if (!self) \
@@ -123,7 +130,7 @@
return TREE_BALANCE_##node##_##field(self); \
} \
\
- struct node *TREE_FIND_##node##_##field \
+ static struct node *_HU_FUNCTION(TREE_FIND_##node##_##field) \
(struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs)) \
{ \
if (!self) \
@@ -136,7 +143,7 @@
return TREE_FIND_##node##_##field(self->field.avl_right, elm, compare); \
} \
\
- struct node *TREE_MOVE_RIGHT(struct node *self, struct node *rhs) \
+ static struct node *_HU_FUNCTION(TREE_MOVE_RIGHT)(struct node *self, struct node *rhs) \
{ \
if (!self) \
return rhs; \
@@ -144,7 +151,7 @@
return TREE_BALANCE_##node##_##field(self); \
} \
\
- struct node *TREE_REMOVE_##node##_##field \
+ static struct node *_HU_FUNCTION(TREE_REMOVE_##node##_##field) \
(struct node *self, struct node *elm, int (*compare)(struct node *lhs, struct node *rhs)) \
{ \
if (!self) return 0; \
@@ -163,7 +170,7 @@
return TREE_BALANCE_##node##_##field(self); \
} \
\
- void TREE_FORWARD_APPLY_ALL_##node##_##field \
+ static void _HU_FUNCTION(TREE_FORWARD_APPLY_ALL_##node##_##field) \
(struct node *self, void (*function)(struct node *node, void *data), void *data) \
{ \
if (self) \
@@ -174,7 +181,7 @@
} \
} \
\
- void TREE_REVERSE_APPLY_ALL_##node##_##field \
+ static void _HU_FUNCTION(TREE_REVERSE_APPLY_ALL_##node##_##field) \
(struct node *self, void (*function)(struct node *node, void *data), void *data) \
{ \
if (self) \