diff options
Diffstat (limited to 'lib/qtimers.h')
-rw-r--r-- | lib/qtimers.h | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/lib/qtimers.h b/lib/qtimers.h index 5beb931b..16808f1b 100644 --- a/lib/qtimers.h +++ b/lib/qtimers.h @@ -22,16 +22,12 @@ #ifndef _ZEBRA_QTIMERS_H #define _ZEBRA_QTIMERS_H -#include <stdbool.h> +#include "misc.h" #include "zassert.h" #include "qtime.h" #include "heap.h" -#ifndef Inline -#define Inline static inline -#endif - /*============================================================================== * Quagga Timers -- qtimer_xxxx * @@ -39,6 +35,39 @@ * each with an action to be executed when the timer expires. */ +/*------------------------------------------------------------------------------ + * Sort out QTIMERS_DEBUG. + * + * Set to 1 if defined, but blank. + * Set to QDEBUG if not defined. + * + * Force to 0 if QTIMERS_NO_DEBUG is defined and not zero. + * + * So: defaults to same as QDEBUG, but no matter what QDEBUG is set to: + * + * * can set QTIMERS_DEBUG == 0 to turn off debug + * * or set QTIMERS_DEBUG != 0 to turn on debug + * * or set QTIMERS_NO_DEBUG != 0 to force debug off + */ + +#ifdef QTIMERS_DEBUG /* If defined, make it 1 or 0 */ +# if IS_BLANK_OPTION(QTIMERS_DEBUG) +# undef QTIMERS_DEBUG +# define QTIMERS_DEBUG 1 +# endif +#else /* If not defined, follow QDEBUG */ +# define QTIMERS_DEBUG QDEBUG +#endif + +#ifdef QTIMERS_NO_DEBUG /* Override, if defined */ +# if IS_NOT_ZERO_OPTION(QTIMERS_NO_DEBUG) +# undef QTIMERS_DEBUG +# define QTIMERS_DEBUG 0 +# endif +#endif + +enum { qtimers_debug = QTIMERS_DEBUG } ; + /*============================================================================== * Data Structures. */ @@ -76,7 +105,7 @@ struct qtimer_pile extern qtimer_pile qtimer_pile_init_new(qtimer_pile qtp) ; extern bool qtimer_pile_dispatch_next(qtimer_pile qtp, qtime_mono_t upto) ; extern qtime_t qtimer_pile_top_wait(qtimer_pile qtp, qtime_t max_wait) ; -extern qtimer qtimer_pile_ream(qtimer_pile qtp, int free_structure) ; +extern qtimer qtimer_pile_ream(qtimer_pile qtp, free_keep_b free_structure) ; /* Ream out qtimer pile and free the qtimer structure. */ #define qtimer_pile_ream_free(qtp) qtimer_pile_ream(qtp, 1) |