MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_free

Function lua_free

src/Chain/libraries/glua/lstate.cpp:438–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438void lua_free(lua_State *L, void *address)
439{
440 if (nullptr == address || nullptr == L)
441 return;
442 auto offset = (intptr_t)address - (intptr_t)L->malloc_buffer;
443 if (offset < 0 || offset > LUA_MALLOC_TOTAL_SIZE)
444 return;
445 size_t offset_size = (size_t)offset;
446 for (auto it = L->malloced_buffers->begin(); it != L->malloced_buffers->end(); ++it)
447 {
448 if (it->first == offset_size)
449 {
450 L->malloced_buffers->erase(it);
451 return;
452 }
453 }
454}

Callers 1

close_lua_stateFunction · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected