MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaM_shrinkvector_

Function luaM_shrinkvector_

third-party/lua-5.5.0/src/lmem.c:128–137  ·  view source on GitHub ↗

** In prototypes, the size of the array is also its number of ** elements (to save memory). So, if it cannot shrink an array ** to its number of elements, the only option is to raise an ** error. */

Source from the content-addressed store, hash-verified

126** error.
127*/
128void *luaM_shrinkvector_ (lua_State *L, void *block, int *size,
129 int final_n, unsigned size_elem) {
130 void *newblock;
131 size_t oldsize = cast_sizet(*size) * size_elem;
132 size_t newsize = cast_sizet(final_n) * size_elem;
133 lua_assert(newsize <= oldsize);
134 newblock = luaM_saferealloc_(L, block, oldsize, newsize);
135 *size = final_n;
136 return newblock;
137}
138
139/* }================================================================== */
140

Callers

nothing calls this directly

Calls 1

luaM_saferealloc_Function · 0.70

Tested by

no test coverage detected