| 46 | |
| 47 | |
| 48 | void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, |
| 49 | int limit, const char *what) { |
| 50 | void *newblock; |
| 51 | int newsize; |
| 52 | if (*size >= limit/2) { /* cannot double it? */ |
| 53 | if (*size >= limit) /* cannot grow even a little? */ |
| 54 | luaG_runerror(L, "too many %s (limit is %d)", what, limit); |
| 55 | newsize = limit; /* still have at least one free place */ |
| 56 | } |
| 57 | else { |
| 58 | newsize = (*size)*2; |
| 59 | if (newsize < MINSIZEARRAY) |
| 60 | newsize = MINSIZEARRAY; /* minimum size */ |
| 61 | } |
| 62 | newblock = luaM_reallocv(L, block, *size, newsize, size_elems); |
| 63 | *size = newsize; /* update only when everything else is OK */ |
| 64 | return newblock; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | l_noret luaM_toobig (lua_State *L) { |
nothing calls this directly
no test coverage detected