From: Jérémie Astor Date: Mon, 6 Sep 2021 10:47:23 +0000 (+0200) Subject: :art: Use struct M_Vector in Array:[T] X-Git-Tag: nightly~470^2~4 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=5ef766c9c240a8e7effc63ff7f292b17d460c4d0;p=gwion.git :art: Use struct M_Vector in Array:[T] --- diff --git a/include/object.h b/include/object.h index 07b88771..af933b4a 100644 --- a/include/object.h +++ b/include/object.h @@ -26,7 +26,7 @@ ANN void broadcast(const M_Object); #define ME(o) (*(VM_Shred *)((M_Object)o)->data) #define EV_SHREDS(o) (*(struct Vector_ *)((M_Object)o)->data) #define UGEN(o) (*(UGen *)((M_Object)o)->data) -#define ARRAY(o) (*(M_Vector *)((M_Object)o)->data) +#define ARRAY(o) (&*(struct M_Vector_ *)((M_Object)o)->data) #define IO_FILE(o) (*(FILE **)(((M_Object)o)->data + SZ_INT)) static inline void _release(const restrict M_Object obj, diff --git a/plug b/plug index 454a6ab0..e3693aa9 160000 --- a/plug +++ b/plug @@ -1 +1 @@ -Subproject commit 454a6ab0f2b34798203a7e770e3582603d198499 +Subproject commit e3693aa9d760b47b804cb87d14efd8ae178480c2 diff --git a/src/lib/array.c b/src/lib/array.c index d628ae6a..0bd3558b 100644 --- a/src/lib/array.c +++ b/src/lib/array.c @@ -17,7 +17,8 @@ static DTOR(array_dtor) { if (*(void **)(o->data + SZ_INT)) xfree(*(void **)(o->data + SZ_INT)); struct M_Vector_ *a = ARRAY(o); - free_m_vector(shred->info->mp, a); +// free_m_vector(shred->info->mp, a); + m_vector_release(a); } static DTOR(array_dtor_obj) { @@ -38,7 +39,8 @@ ANN M_Object new_array(MemPool p, const Type t, const m_uint length) { const m_uint depth = !tflag(t, tflag_typedef) ? t->array_depth : t->info->parent->array_depth; const m_uint size = depth > 1 ? SZ_INT : array_base(t)->size; - ARRAY(a) = new_m_vector(p, size, length); + //ARRAY(a) = new_m_vector(p, size, length); + m_vector_init(ARRAY(a), size, length); return a; }