]> Nishi Git Mirror - gwion.git/commitdiff
:art: do not use asprintf
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 14 Sep 2020 11:49:58 +0000 (13:49 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 14 Sep 2020 11:49:58 +0000 (13:49 +0200)
src/lib/lib_func.c
util

index da0f858665b88d5fcc5f4bcf7b49044e063a8f71..8632498f1744b2904459df161f9c406cda8c3e50 100644 (file)
@@ -201,10 +201,10 @@ static OP_CHECK(opck_auto_fptr) {
   // TODO: we could check first if there a matching existing one
   Func_Base *const fbase = cpy_func_base(env->gwion->mp, bin->lhs->info->type->e->d.func->def->base);
   const Fptr_Def fptr_def = new_fptr_def(env->gwion->mp, fbase, bin->lhs->info->type->e->d.func->def->flag);
-  m_str name = NULL;
-  asprintf(&name, "generated@%u:%u", bin->rhs->pos->first.line, bin->rhs->pos->first.column);
+  char name[13 + strlen(env->curr->name) +
+    num_digit(bin->rhs->pos->first.line) + num_digit(bin->rhs->pos->first.column)];
+  sprintf(name, "generated@%s@%u:%u", env->curr->name, bin->rhs->pos->first.line, bin->rhs->pos->first.column);
   fptr_def->base->xid = insert_symbol(name);
-  free(name);
   const m_bool ret = traverse_fptr_def(env, fptr_def);
   const Type t = fptr_def->type;
   free_fptr_def(env->gwion->mp, fptr_def);
diff --git a/util b/util
index 9de9e5f76f54308e8240114a6c8260fcb442f6dd..8a433d3220026c2819e3e27d00e014c6b73b5def 160000 (submodule)
--- a/util
+++ b/util
@@ -1 +1 @@
-Subproject commit 9de9e5f76f54308e8240114a6c8260fcb442f6dd
+Subproject commit 8a433d3220026c2819e3e27d00e014c6b73b5def