+ /*
+ * Have to go looking down chain for it.
+ * Top points to what we are looking at,
+ * prevtop points to previous top.
+ * We know it is not at the head of the chain.
+ */
+ for (; /* goto done */; ) {
+ if (top->link == 0) {
+ /*
+ * Top is end of the chain and none of the chain
+ * had top->selfpc == selfpc.
+ * So we allocate a new tostruct
+ * and link it to the head of the chain.
+ */
+ toindex = ++tos[0].link;
+ if (toindex >= tolimit)
+ goto overflow;
+ top = &tos[toindex];
+ top->selfpc = selfpc;
+ top->count = 1;
+ top->link = *frompcindex;
+ *frompcindex = toindex;
+ goto done;
+ }
+ /*
+ * Otherwise, check the next arc on the chain.
+ */
+ prevtop = top;
+ top = &tos[top->link];