add macro fast_mblock_to_node_ptr

pull/1/head
yuqing 2014-06-05 18:16:20 +08:00
parent 80fba80f41
commit f4dacfda98
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,10 @@ struct fast_mblock_man
pthread_mutex_t lock; //the lock for read / write free node chain pthread_mutex_t lock; //the lock for read / write free node chain
}; };
#define fast_mblock_to_node_ptr(data_ptr) \
(struct fast_mblock_node *)(data_ptr - ((size_t)(char *) \
&((struct fast_mblock_node *)0)->data))
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif