static void ls_print_tree(GNode *node, gboolean deep) { __extension__ void node_walk(GNode *node, guint off, gboolean deep) { node = g_node_first_child(node); for (; node != NULL; node = g_node_next_sibling(node)) { if (G_NODE_IS_LEAF(node)) continue; g_print("%*s%s\n", off, "", (gchar *) node->data); if (deep) node_walk(node, off + 2, deep); } }
struct hit *find_name(struct project *project, struct name *name) { if (name) { struct finddata finddata; int i; finddata.hit = NULL; finddata.name = name; for (i = project->count - 1; i >= 0; --i) { struct cfile *cur = project->files[i]; finddata.block = cur->block; finddata.cfile = cur; node_walk(cur->node, does_match, &finddata); } return reverse(finddata.hit); } return NULL; }