From: fennecdjay Date: Sun, 23 Jun 2019 11:54:00 +0000 (+0200) Subject: :art: Use mp for Text X-Git-Tag: nightly~2402 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=fbb9dada77c346cd6c0475fe9b206c01f2791c44;p=gwion.git :art: Use mp for Text --- diff --git a/ast b/ast index f675cd4f..ce24578b 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit f675cd4f7efd9ac1b438641d0a69ff4ec38cca01 +Subproject commit ce24578bdde09d4f05435e6a5c2083c6853eb410 diff --git a/src/parse/type_decl.c b/src/parse/type_decl.c index c3ec7d0a..9b88f18e 100644 --- a/src/parse/type_decl.c +++ b/src/parse/type_decl.c @@ -27,7 +27,7 @@ ANN static void td_info_run(const Env env, struct td_info* info) { do { m_str name = td2str(env, tl->td); text_add(&info->text, name); - xfree(name); + xfree(name);// we can delete that after PoolizeStrings if(tl->next) text_add(&info->text, ","); } while((tl = tl->next)); @@ -37,7 +37,9 @@ ANEW ANN static m_str td2str(const Env env, const Type_Decl* td) { m_uint depth = td->array ? td->array->depth : 0; const size_t len = id_list_len(td->xid) + depth * 2; const size_t cap = round2szint(len); - struct td_info info = { td->types, { (m_str)xmalloc(cap), cap, len }}; + struct td_info info = { td->types, + { (m_str)mp_malloc2(env->gwion->mp, cap), cap, len, env->gwion->mp } + }; type_path(info.text.str, td->xid); while(depth--) { text_add(&info.text, "[]"); } Type_List tl = td->types; @@ -46,13 +48,15 @@ ANEW ANN static m_str td2str(const Env env, const Type_Decl* td) { td_info_run(env, &info); text_add(&info.text, ">"); } - return info.text.str; + const m_str str = strdup(info.text.str); + text_release(&info.text); + return str; } ANEW ANN m_str tl2str(const Env env, Type_List tl) { - struct td_info info = { .tl=tl }; + struct td_info info = { .tl=tl, { .mp=env->gwion->mp} }; td_info_run(env, &info); - return info.text.str; + return strdup(info.text.str); } ANN static inline void* type_unknown(const Env env, const ID_List id) { diff --git a/util b/util index 067828e0..f3a4b121 160000 --- a/util +++ b/util @@ -1 +1 @@ -Subproject commit 067828e05f68a2d005d81ff627e3680059c0803e +Subproject commit f3a4b121af122f2b421cc1e58c812210305e2d1c