diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tree.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -58,9 +58,23 @@ print_tree(MqTree *node) print_tree_recurse(node, 0); } +static void +print_node(MqTree *node) +{ + g_print("\t0x%" PRIxPTR "\n", (uintptr_t) node); +} + +static void +print_head(const gchar *head, MqTree *node) +{ + g_print("%s, at 0x%" PRIxPTR "\n", head, (uintptr_t) node); +} + #else /* MQ_TREE_DEBUG */ #define print_tree(node) +#define print_node(node) +#define print_head(head, node) #endif /* MQ_TREE_DEBUG */ @@ -205,6 +219,7 @@ foreach(MqTree *node, gboolean (*cb)(MqTree *node, gpointer user_data), { for (; node; node = node->next) { /* XXX: Warning: Does not skip root node */ + print_node(node); if (cb(node, user_data) == MQ_TREE_STOP) { return MQ_TREE_STOP; } @@ -224,6 +239,8 @@ void mq_tree_foreach(MqTree *node, gboolean (*cb)(MqTree *node, gpointer user_data), gpointer user_data) { + print_head("foreach", node); + foreach(node->root->first_child, cb, user_data); } @@ -232,6 +249,7 @@ foreach_from(MqTree *node, gboolean (*cb)(MqTree *node, gpointer user_data), gpointer user_data) { for (; node; node = node->next) { + print_node(node); if (cb(node, user_data) == MQ_TREE_STOP) { return MQ_TREE_STOP; } @@ -256,5 +274,7 @@ void mq_tree_foreach_from(MqTree *node, gboolean (*cb)(MqTree *node, gpointer user_data), gpointer user_data) { + print_head("foreach from", node); + foreach_from(node, cb, user_data); } |