From 72738c031c0f412d0a7348f33f7c4ba6d2a0bf01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 1 Apr 2020 17:58:33 +0200 Subject: [PATCH] :art: Fix variadic import test --- tests/import/rm_me.gw | 1 + tests/import/variadic.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 tests/import/rm_me.gw diff --git a/tests/import/rm_me.gw b/tests/import/rm_me.gw new file mode 100644 index 00000000..69126156 --- /dev/null +++ b/tests/import/rm_me.gw @@ -0,0 +1 @@ +1; \ No newline at end of file diff --git a/tests/import/variadic.c b/tests/import/variadic.c index 6b00bdbf..4b8b7cd6 100644 --- a/tests/import/variadic.c +++ b/tests/import/variadic.c @@ -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) { -- 2.43.0