]> Nishi Git Mirror - gwion.git/commitdiff
:art: Fix variadic import test
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Wed, 1 Apr 2020 15:58:33 +0000 (17:58 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Wed, 1 Apr 2020 15:58:33 +0000 (17:58 +0200)
tests/import/rm_me.gw [new file with mode: 0644]
tests/import/variadic.c

diff --git a/tests/import/rm_me.gw b/tests/import/rm_me.gw
new file mode 100644 (file)
index 0000000..6912615
--- /dev/null
@@ -0,0 +1 @@
+1;
\ No newline at end of file
index 6b00bdbf83a38ee2645dd01eae4892792fa513cf..4b8b7cd6fd9a3ed21e48d7933029d7ce90371650 100644 (file)
@@ -18,9 +18,11 @@ static MFUN(m_variadic) {
   M_Object str_obj = *(M_Object*)MEM(SZ_INT);
   if(!str_obj)return;
   m_str str = STRING(str_obj);
-  struct Vararg_* arg = *(struct Vararg_**)MEM(SZ_INT*2);
+  const M_Object vararg_obj = *(M_Object*)MEM(SZ_INT*2);
+  struct Vararg_* arg = *(struct Vararg_**)vararg_obj->data;
 
-  while(arg->i < arg->s) {
+  m_uint i = 0;
+  while(i < arg->s) {
     if(*str == 'i') {
       printf("%" INT_F "\n", *(m_int*)(arg->d + arg->o));
       arg->o += SZ_INT;
@@ -31,10 +33,9 @@ static MFUN(m_variadic) {
       printf("%p\n", (void*)*(M_Object*)(arg->d + arg->o));
       arg->o += SZ_INT;
     }
-    arg->i++;
+    ++i;
     str++;
   }
-  free_vararg(shred->info->mp, arg);
 }
 
 GWION_IMPORT(variadic test) {