From: Jérémie Astor Date: Wed, 1 Apr 2020 15:58:33 +0000 (+0200) Subject: :art: Fix variadic import test X-Git-Tag: nightly~1726^2~10 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=72738c031c0f412d0a7348f33f7c4ba6d2a0bf01;p=gwion.git :art: Fix variadic import test --- 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) {