]> rtime.felk.cvut.cz Git - ulut.git/blobdiff - ulut/ul_gavl.h
Silent some GCC warnings.
[ulut.git] / ulut / ul_gavl.h
index 926c69f8ceabcbe8fd90d2f52d5818076c055513..9962bb57335e1f0f7ce54c07fe1120d3f5376fbd 100644 (file)
@@ -40,7 +40,7 @@ extern "C" {
 #define GAVL_UNBALANCED_SUPPORT
 
 /* function to compare fields of two items */
-typedef int gavl_cmp_fnc_t(const void *a, const void *b);
+typedef int gavl_cmp_fnc_t(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /**
  * struct gavl_node - Structure Representing Node of Generic AVL Tree
@@ -101,6 +101,8 @@ gavl_next_node(const gavl_node_t *node);
 gavl_node_t *
 gavl_prev_node(const gavl_node_t *node);
 
+#if !defined(SDCC) && !defined(__SDCC)
+
 int
 gavl_is_empty(const gavl_root_t *root);
 
@@ -198,6 +200,8 @@ gavl_node2key(const gavl_root_t *root, const gavl_node_t *node)
   return (void*)(p+root->key_offs);
 }
 
+#endif /*SDCC*/
+
 int
 gavl_balance_one(gavl_node_t **subtree);
 
@@ -247,6 +251,8 @@ gavl_delete_and_next_node(gavl_root_t *root, gavl_node_t *node);
 /*===========================================================*/
 /* iterators for generic GAVL type */
 
+#if !defined(SDCC) && !defined(__SDCC)
+
 typedef struct {
   gavl_root_t *container;
   gavl_node_t *node;
@@ -351,12 +357,14 @@ gavl_find_after_it(gavl_root_t *container, const void *key, gavl_it_t *it)
 #define gavl_generic_for_each_cut(item_t, root, ptr) \
        for(;(ptr=(item_t*)gavl_cut_first(root));)
 
+#endif /*SDCC*/
+
 /*===========================================================*/
 /* basic types compare functions */
 
-int gavl_cmp_int(const void *a, const void *b);
-int gavl_cmp_long(const void *a, const void *b);
-int gavl_cmp_ptr(const void *a, const void *b);
+int gavl_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT;
+int gavl_cmp_long(const void *a, const void *b) UL_ATTR_REENTRANT;
+int gavl_cmp_ptr(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /*===========================================================*/
 /* More functions useful for partially balanced trees */
@@ -417,7 +425,10 @@ typedef struct{
 \
 static inline cust_item_t * \
 cust_prefix##_node2item(const cust_root_t *root, const gavl_node_t *node) \
-  {return (cust_item_t*)((char*)node-(long)&((cust_item_t*)0)->cust_item_node);}\
+{\
+  (void)root;\
+  return UL_CONTAINEROF(node, cust_item_t, cust_item_node);\
+}\
 \
 static inline cust_key_t *\
 cust_prefix##_node2key(const cust_root_t *root, gavl_node_t *node)\