** precall for C functions */
| 491 | ** precall for C functions |
| 492 | */ |
| 493 | l_sinline int precallC (lua_State *L, StkId func, int nresults, |
| 494 | lua_CFunction f) { |
| 495 | int n; /* number of returns */ |
| 496 | CallInfo *ci; |
| 497 | checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ |
| 498 | L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, |
| 499 | L->top + LUA_MINSTACK); |
| 500 | lua_assert(ci->top <= L->stack_last); |
| 501 | if (l_unlikely(L->hookmask & LUA_MASKCALL)) { |
| 502 | int narg = cast_int(L->top - func) - 1; |
| 503 | luaD_hook(L, LUA_HOOKCALL, -1, 1, narg); |
| 504 | } |
| 505 | lua_unlock(L); |
| 506 | n = (*f)(L); /* do the actual call */ |
| 507 | lua_lock(L); |
| 508 | api_checknelems(L, n); |
| 509 | luaD_poscall(L, ci, n); |
| 510 | return n; |
| 511 | } |
| 512 | |
| 513 | |
| 514 | /* |
no test coverage detected