+/** Get the next node if available or the same node again.
+ *
+ * \param type The type of the containing data structure
+ *
+ * \param node The variable name for current node in the iteration;
+ * this will be declared as a pointer to \p type
+ *
+ * \param field The rb_node field in containing data structure
+ */
+#define rb_tree_node_next_if_available(type, node, field) \
+ (&node->field != NULL) ? rb_node_data(type, rb_node_next(&node->field), field) : node
+
+/** Get the previous node if available or the same node again.
+ *
+ * \param type The type of the containing data structure
+ *
+ * \param node The variable name for current node in the iteration;
+ * this will be declared as a pointer to \p type
+ *
+ * \param field The rb_node field in containing data structure
+ */
+#define rb_tree_node_prev_if_available(type, node, field) \
+ (&node->field != NULL) ? rb_node_data(type, rb_node_prev(&node->field), field) : node
+