about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
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 */
lass='alt'>
90538f23 ^


90538f23 ^
300f4554 ^
90538f23 ^
d9d9ab81 ^


099f0d5d ^

418ea7d3 ^
e97b446a ^
90538f23 ^









531f14c9 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40