static void dwarf_twalk_inner(struct ts_entry *p, void (*action)(const void *nodep, const DW_VISIT which, const int depth), unsigned level) { if (!p->llink && !p->rlink) { action((const void *)(&(p->keyptr)),dwarf_leaf,level); return; } action((const void *)(&(p->keyptr)),dwarf_preorder,level); if(p->llink) { dwarf_twalk_inner(p->llink,action,level+1); } action((const void *)(&(p->keyptr)),dwarf_postorder,level); if(p->rlink) { dwarf_twalk_inner(p->rlink,action,level+1); } action((const void *)(&(p->keyptr)),dwarf_endorder,level); }
void dwarf_twalk(const void *rootp, void (*action)(const void *nodep, const DW_VISIT which, const int depth)) { const struct hs_base *head = (const struct hs_base *)rootp; struct ts_entry *root = 0; if(!head) { return; } root = head->hashtab_; /* Get to actual tree. */ dwarf_twalk_inner(head,root,action,0); }
void dwarf_twalk(const void *headin, void (*action)(const void *nodep, const DW_VISIT which, const int depth)) { const struct ts_entry *head = (const struct ts_entry *)headin; const struct ts_entry *root = 0; if(!head) { return; } root = head->rlink; if(!root) { return; } dwarf_twalk_inner(root,action,0); }
void dwarf_twalk(const void *rootp, void (*action)(const void *nodep, const DW_VISIT which, const int depth)) { struct ts_entry *head = (struct ts_entry *)rootp; struct ts_entry *root = 0; if(!head) { return; } root = head->rlink; if(!root) { return; } /* Get to actual tree. */ dwarf_twalk_inner(root,action,0); }