nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ff398dd
)
nitg-g: Fix allocation of NativeArray
author
Lucas Bajolet
<r4pass@hotmail.com>
Thu, 28 May 2015 21:09:27 +0000
(17:09 -0400)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Thu, 28 May 2015 21:11:17 +0000
(17:11 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
src/compiler/global_compiler.nit
patch
|
blob
|
history
diff --git
a/src/compiler/global_compiler.nit
b/src/compiler/global_compiler.nit
index
b2cf479
..
49671f9
100644
(file)
--- a/
src/compiler/global_compiler.nit
+++ b/
src/compiler/global_compiler.nit
@@
-247,7
+247,7
@@
class GlobalCompiler
res.is_exact = true
if is_native_array then
var mtype_elt = mtype.arguments.first
- v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}) + length*sizeof({mtype_elt.ctype}));")
+ v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}) + length*sizeof(val*));")
v.add("((struct {mtype.c_name}*){res})->length = length;")
else
v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}));")