[gtk/wip/otte/for-master: 3/9] rbtree: Simplify macros
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master: 3/9] rbtree: Simplify macros
- Date: Thu, 5 Mar 2020 07:00:18 +0000 (UTC)
commit dc86c744bf2422c0a5d51c718e8e844033388068
Author: Benjamin Otte <otte redhat com>
Date: Thu Mar 5 06:53:26 2020 +0100
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
gtk/gtkrbtree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c
index 55914d7cb6..79bb9b5911 100644
--- a/gtk/gtkrbtree.c
+++ b/gtk/gtkrbtree.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]