forked from AuroraMiddleware/gtk
rbtree: Simplify macros
* NODE_FROM_POINTER() can not be NULL * shuffle NODE_TO_POINTER() code for readability so that the NULL check is on the outside and not the cast
This commit is contained in:
parent
9fedcec82e
commit
dc86c744bf
@ -61,8 +61,8 @@ struct _GtkRbNode
|
||||
};
|
||||
};
|
||||
|
||||
#define NODE_FROM_POINTER(ptr) ((GtkRbNode *) ((ptr) ? (((guchar *) (ptr)) - sizeof (GtkRbNode)) : NULL))
|
||||
#define NODE_TO_POINTER(node) ((gpointer) ((node) ? (((guchar *) (node)) + sizeof (GtkRbNode)) : NULL))
|
||||
#define NODE_FROM_POINTER(ptr) ((GtkRbNode *) (((guchar *) (ptr)) - sizeof (GtkRbNode)))
|
||||
#define NODE_TO_POINTER(node) ((node) ? ((gpointer) (((guchar *) (node)) + sizeof (GtkRbNode))) : NULL)
|
||||
#define NODE_TO_AUG_POINTER(tree, node) ((gpointer) ((node) ? (((guchar *) (node)) + sizeof (GtkRbNode) + (tree)->element_size) : NULL))
|
||||
|
||||
static inline gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user