Update lua-array to use cosmopolitan headers

This commit is contained in:
Paul Kulchenko 2021-08-03 19:00:55 -07:00
parent f596b28443
commit 0e5db681a1
6 changed files with 25 additions and 25 deletions

View file

@ -18,7 +18,7 @@
#include "third_party/lua/lstate.h"
#include "third_party/lua/lstring.h"
#include "third_party/lua/ltable.h"
#include "larray.h"
#include "third_party/lua/larray.h"
#include "third_party/lua/ltm.h"
#include "third_party/lua/lua.h"
#include "third_party/lua/lundump.h"
@ -759,9 +759,8 @@ LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
t = luaH_new(L);
sethvalue2s(L, L->top, t);
api_incr_top(L);
if (narray > 0 || nrec > 0) {
if (narray > 0 || nrec > 0)
luaH_resize(L, t, narray, nrec);
}
luaC_checkGC(L);
lua_unlock(L);
}

View file

@ -3,27 +3,31 @@
** See Copyright Notice in lua.h
*/
asm(".ident\t\"\\n\\n\
lua-array (MIT License)\\n\
Copyright 2018-2021 Petri Häkkinen\"");
asm(".include \"libc/disclaimer.inc\"");
#define larray_c
#define LUA_CORE
#include "lprefix.h"
#include "third_party/lua/lprefix.h"
#include <libc/math.h>
#include <libc/limits.h>
#include <math.h>
#include <limits.h>
#include "third_party/lua/lua.h"
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "larray.h"
#include "lvm.h"
#include "third_party/lua/ldebug.h"
#include "third_party/lua/ldo.h"
#include "third_party/lua/lgc.h"
#include "third_party/lua/lmem.h"
#include "third_party/lua/lobject.h"
#include "third_party/lua/lstate.h"
#include "third_party/lua/lstring.h"
#include "third_party/lua/ltable.h"
#include "third_party/lua/larray.h"
#include "third_party/lua/lvm.h"
Array *luaA_new (lua_State *L) {
GCObject *o = luaC_newobj(L, LUA_TARRAY, sizeof(Array));

View file

@ -6,9 +6,8 @@
#ifndef larray_h
#define larray_h
#include "lobject.h"
#include "third_party/lua/lobject.h"
#define luaH_emptyobject (&luaH_emptyobject_)
#define luaO_nilobject (&G(L)->nilvalue)
LUAI_FUNC Array *luaA_new (lua_State *L);

View file

@ -17,7 +17,7 @@
#include "third_party/lua/lstate.h"
#include "third_party/lua/lstring.h"
#include "third_party/lua/ltable.h"
#include "larray.h"
#include "third_party/lua/larray.h"
#include "third_party/lua/ltm.h"
#include "third_party/lua/lua.h"

View file

@ -17,7 +17,7 @@
#include "third_party/lua/lstate.h"
#include "third_party/lua/lstring.h"
#include "third_party/lua/ltable.h"
#include "larray.h"
#include "third_party/lua/larray.h"
#include "third_party/lua/ltm.h"
#include "third_party/lua/lua.h"
#include "third_party/lua/lvm.h"
@ -1818,9 +1818,8 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
last += GETARG_Ax(*pc) * (MAXARG_C + 1);
pc++;
}
if (last > luaH_realasize(h)) { /* needs more space? */
if (last > luaH_realasize(h)) /* needs more space? */
luaH_resizearray(L, h, last); /* preallocate it at once */
}
for (; n > 0; n--) {
TValue *val = s2v(ra + n);
setobj2t(L, &h->array[last - 1], val);

View file

@ -100,7 +100,6 @@ typedef enum {
** Special case of 'luaV_fastget' for integers, inlining the fast case
** of 'luaH_getint'.
*/
#define luaV_fastgeti(L,t,k,slot) \
(!ttistable(t) \
? (slot = NULL, 0) /* not a table; 'slot' is NULL and result is 0 */ \