about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua.c')
-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 */