/* printtree1 - recursively print tree p */ static void printtree1(Tree p, int fd, int lev) { FILE *f = fd == 1 ? stdout : stderr; int i; static char blanks[] = " "; if (p == 0 || *printed(i = nodeid(p))) return; fprint(f, "#%d%S%S", i, blanks, i < 10 ? 2 : i < 100 ? 1 : 0, blanks, lev); fprint(f, "%s %t", opname(p->op), p->type); *printed(i) = 1; for (i = 0; i < NELEMS(p->kids); i++) if (p->kids[i]) fprint(f, " #%d", nodeid(p->kids[i])); if (p->op == FIELD && p->u.field) fprint(f, " %s %d..%d", p->u.field->name, fieldsize(p->u.field) + fieldright(p->u.field), fieldright(p->u.field)); else if (generic(p->op) == CNST) fprint(f, " %s", vtoa(p->type, p->u.v)); else if (p->u.sym) fprint(f, " %s", p->u.sym->name); if (p->node) fprint(f, " node=%p", p->node); fprint(f, "\n"); for (i = 0; i < NELEMS(p->kids); i++) printtree1(p->kids[i], fd, lev + 1); }
static void cache_add_cache(struct peer_cache *dst, const struct peer_cache *add) { int i, meta_size; const uint8_t *meta; meta = get_metadata(add, &meta_size); for (i = 0; nodeid(add, i); i++) { cache_add(dst, nodeid(add, i), meta + (meta_size * i), meta_size); } }