/*===========================================================*/
/* basic types compare functions */
-int gavl_cmp_int(const void *a, const void *b)
+int gavl_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT
{
if (*(int*)a>*(int*)b) return 1;
if (*(int*)a<*(int*)b) return -1;
return 0;
}
-int gavl_cmp_long(const void *a, const void *b)
+int gavl_cmp_long(const void *a, const void *b) UL_ATTR_REENTRANT
{
if (*(long*)a>*(long*)b) return 1;
if (*(long*)a<*(long*)b) return -1;
return 0;
}
-int gavl_cmp_ptr(const void *a, const void *b)
+int gavl_cmp_ptr(const void *a, const void *b) UL_ATTR_REENTRANT
{
if (*(void**)a>*(void**)b) return 1;
if (*(void**)a<*(void**)b) return -1;
#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
gavl_node_t *
gavl_prev_node(const gavl_node_t *node);
+#ifndef SDCC
+
int
gavl_is_empty(const gavl_root_t *root);
return (void*)(p+root->key_offs);
}
+#endif /*SDCC*/
+
int
gavl_balance_one(gavl_node_t **subtree);
/*===========================================================*/
/* iterators for generic GAVL type */
+#ifndef SDCC
+
typedef struct {
gavl_root_t *container;
gavl_node_t *node;
#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 */
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
+#ifndef SDCC
#include <sys/time.h>
+#endif
#include "ul_utmalloc.h"
#include "ul_gavl.h"
int depth;
gavl_node_t *node;
gavl_root_t *root;
- int (*node_fnc)(gavl_node_t *node, struct gavl_check_st *check);
+ int (*node_fnc)(gavl_node_t *node, struct gavl_check_st *check) UL_ATTR_REENTRANT;
void *context;
int *status;
} gavl_check_st_t;
return gsa_resort_buble(array,array->key_offs,array->cmp_fnc);
}
-int gsa_cmp_int(const void *a, const void *b)
+int gsa_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT
{
return *(int*)a-*(int*)b;
}
-int gsa_cmp_ulong(const void *a, const void *b)
+int gsa_cmp_ulong(const void *a, const void *b) UL_ATTR_REENTRANT
{
return *(unsigned long*)a-*(unsigned long*)b;
}
#define GSA_FAFTER 2
/* function to compare fields of two array items */
-typedef int gsa_cmp_fnc_t(const void *a, const void *b);
+typedef int gsa_cmp_fnc_t(const void *a, const void *b) UL_ATTR_REENTRANT;
/* compare two integer fields */
-int gsa_cmp_int(const void *a, const void *b);
+int gsa_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT;
/* compare two unsigned long fields */
-int gsa_cmp_ulong(const void *a, const void *b);
+int gsa_cmp_ulong(const void *a, const void *b) UL_ATTR_REENTRANT;
/* define structure representing head of array */
#define GSA_ARRAY_FOR(_type) \
/* Additional, user defined fields for ul_htimer_t structure */
#define UL_HTIMER_USER_FIELDS
-typedef void (ul_htimer_fnc_t)(unsigned long data);
+typedef void (ul_htimer_fnc_t)(unsigned long data) UL_ATTR_REENTRANT;
/* The wrapper for ul_htimer_run_expired */
#define UL_HTIMER_FNC_CALL(queue, timer, pact_time) \
#ifdef UL_HTIMER_WITH_STD_TYPE
typedef struct ul_root_htimer_ops_t {
- int (*timer_root_init)(int options, void *context);
- ul_htimer_queue_t *(*timer_root_get)(int options, void *context);
- void (*timer_root_put)(ul_htimer_queue_t *queue);
- int (*current_time)(int options, ul_htim_time_t *htimer_time);
+ int (*timer_root_init)(int options, void *context) UL_ATTR_REENTRANT;
+ ul_htimer_queue_t *(*timer_root_get)(int options, void *context) UL_ATTR_REENTRANT;
+ void (*timer_root_put)(ul_htimer_queue_t *queue) UL_ATTR_REENTRANT;
+ int (*current_time)(int options, ul_htim_time_t *htimer_time) UL_ATTR_REENTRANT;
} ul_root_htimer_ops_t;
extern ul_root_htimer_ops_t *ul_root_htimer_ops;
#include <stdlib.h>
#include <stdio.h>
+#ifndef SDCC
#include <sys/types.h>
+#endif
#include <stdarg.h>
#else /*__RTL__*/
void
ul_log_fnc_default(ul_log_domain_t *domain, int level,
- const char *format, va_list ap);
+ const char *format, va_list ap) UL_ATTR_REENTRANT;
ul_log_fnc_t *ul_log_output;
-#ifndef __RTL__
+#if !defined(__RTL__) && !defined(SDCC)
FILE *ul_log_default_file;
#endif /*__RTL__*/
ul_log_output=log_fnc;
}
-#ifndef __RTL__
+#if !defined(__RTL__) && !defined(SDCC)
void
ul_log_fnc_default(ul_log_domain_t *domain, int level,
const char *format, va_list ap)
}
-#else /*__RTL__*/
+#elif defined(__RTL__)
void
ul_log_fnc_default(ul_log_domain_t *domain, int level,
const char *format, va_list ap)
int
ul_log_check_default_output(void)
{
- #ifndef __RTL__
+ #if !defined(__RTL__) && !defined(SDCC)
char *s;
char *log_fname;
#endif /*__RTL__*/
return 0;
ul_log_output=ul_log_fnc_default;
- #ifndef __RTL__
+ #if !defined(__RTL__) && !defined(SDCC)
if((log_fname=getenv("UL_LOG_FILENAME"))!=NULL){
ul_log_default_file=fopen(log_fname,"a");
}
} ul_log_domain_t;
typedef void (ul_log_fnc_t)(ul_log_domain_t *domain, int level,
- const char *format, va_list ap);
+ const char *format, va_list ap) UL_ATTR_REENTRANT;
void ul_log_redir(ul_log_fnc_t *log_fnc, int add_flags);