badvpn/system/BReactor_badvpn_timerstree.h
ambrop7 da424e04ab system: BReactor: don't store a callback void pointer in BSmallTimer, instead just pass the BSmallTimer pointer to the
callback.

To preserver memory efficiency, switch from SAvl to CAvl and reorder members. To preserve time efficiency, keep a flag indicating 
whether a timer is really a BTimer or not, and directly call the BTimer_handler if it is (as oppossed to having an internal 
callback which calls the BTimer_handler). Additionally, store the timer state in a new member instead of in absTime, as the 
new layout allows so without increasing the size of BSmallTimer.
2012-10-06 20:20:52 +00:00

14 lines
652 B
C

#define CAVL_PARAM_NAME BReactor__TimersTree
#define CAVL_PARAM_FEATURE_COUNTS 0
#define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 0
#define CAVL_PARAM_FEATURE_NOKEYS 1
#define CAVL_PARAM_TYPE_ENTRY struct BSmallTimer_t
#define CAVL_PARAM_TYPE_LINK BReactor_timerstree_link
#define CAVL_PARAM_TYPE_ARG int
#define CAVL_PARAM_VALUE_NULL ((BReactor_timerstree_link)NULL)
#define CAVL_PARAM_FUN_DEREF(arg, link) (link)
#define CAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) compare_timers((entry1).link, (entry2).link)
#define CAVL_PARAM_MEMBER_CHILD u.tree_child
#define CAVL_PARAM_MEMBER_BALANCE tree_balance
#define CAVL_PARAM_MEMBER_PARENT tree_parent