** Check whether pointer 'o' points to some value in the stack frame of ** the current function and, if so, returns its index. Because 'o' may ** not point to a value in this stack, we cannot compare it with the ** region boundaries (undefined behavior in ISO C). */
| 679 | ** region boundaries (undefined behavior in ISO C). |
| 680 | */ |
| 681 | static int instack (CallInfo *ci, const TValue *o) { |
| 682 | int pos; |
| 683 | StkId base = ci->func.p + 1; |
| 684 | for (pos = 0; base + pos < ci->top.p; pos++) { |
| 685 | if (o == s2v(base + pos)) |
| 686 | return pos; |
| 687 | } |
| 688 | return -1; /* not found */ |
| 689 | } |
| 690 | |
| 691 | |
| 692 | /* |