about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-04 08:10:25 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-11-05 08:31:43 -0700
commitf53ca6f804a8a11597206fdc2f8976b10a2b936a (patch)
tree1c3c73a6bb4048a845123c5e28a6cb58aa68134a /src
parent712dc16b236fdb72a666ebe60b00adc1e5c1ef6e (diff)
downloadteliva-f53ca6f804a8a11597206fdc2f8976b10a2b936a.tar.gz
confirmed that this is the same
And it seems simpler to me.
Diffstat (limited to 'src')
-rw-r--r--src/lua.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lua.c b/src/lua.c
index aa73699..3182546 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -378,13 +378,13 @@ static int pmain (lua_State *L) {
 
 typedef struct NumArray {
   int size;
-  double values[1];  /* variable part */
+  double values[0];  /* variable part */
 } NumArray;
 
 
 static int newarray (lua_State *L) {
   int n = luaL_checkint(L, 1);
-  size_t nbytes = sizeof(NumArray) + (n - 1)*sizeof(double);
+  size_t nbytes = sizeof(NumArray) + n*sizeof(double);
   NumArray *a = (NumArray *)lua_newuserdata(L, nbytes);
   a->size = n;
   return 1;  /* new userdatum is already on the stack */