mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-31 17:52:27 +00:00
Use Lua auto buffers when possible
This commit is contained in:
parent
13ee75150c
commit
da6d610056
8 changed files with 204 additions and 101 deletions
|
@ -103,7 +103,7 @@ struct UnixErrno {
|
|||
|
||||
static lua_State *GL;
|
||||
|
||||
void *LuaRealloc(lua_State *L, void *p, size_t n) {
|
||||
static void *LuaRealloc(lua_State *L, void *p, size_t n) {
|
||||
void *p2;
|
||||
if ((p2 = realloc(p, n))) {
|
||||
return p2;
|
||||
|
@ -116,11 +116,11 @@ void *LuaRealloc(lua_State *L, void *p, size_t n) {
|
|||
return p2;
|
||||
}
|
||||
|
||||
void *LuaAlloc(lua_State *L, size_t n) {
|
||||
static void *LuaAlloc(lua_State *L, size_t n) {
|
||||
return LuaRealloc(L, 0, n);
|
||||
}
|
||||
|
||||
void *LuaAllocOrDie(lua_State *L, size_t n) {
|
||||
static void *LuaAllocOrDie(lua_State *L, size_t n) {
|
||||
void *p;
|
||||
if ((p = LuaAlloc(L, n))) {
|
||||
return p;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue