From: fennecdjay Date: Tue, 10 Nov 2020 23:21:41 +0000 (+0100) Subject: :art: const and ternary X-Git-Tag: nightly~1176 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3c2483a6b74602ac76620eecdcf7f690d6926d39;p=gwion.git :art: const and ternary --- diff --git a/src/parse/func_resolve_tmpl.c b/src/parse/func_resolve_tmpl.c index a53d8b52..d274fc0c 100644 --- a/src/parse/func_resolve_tmpl.c +++ b/src/parse/func_resolve_tmpl.c @@ -128,18 +128,16 @@ ANN static Func func_match(const Env env, struct ResolverArgs* ra) { ANN static Func _find_template_match(const Env env, const Value v, const Exp_Call* exp) { CHECK_BO(check_call(env, exp)) const Type_List types = exp->tmpl->call; - Func m_func = NULL, former = env->func; + const Func former = env->func; DECL_OO(const m_str, tmpl_name, = tl2str(env, types)) const m_uint scope = env->scope->depth; struct EnvSet es = { .env=env, .data=env, .func=(_exp_func)check_cdef, .scope=scope, .flag=tflag_check }; - struct ResolverArgs ra = {.v = v, .e = exp, .tmpl_name = tmpl_name, m_func = m_func, .types = types}; + struct ResolverArgs ra = {.v = v, .e = exp, .tmpl_name = tmpl_name, .types = types}; CHECK_BO(envset_push(&es, v->from->owner_class, v->from->owner)) (void)env_push(env, v->from->owner_class, v->from->owner); - if(is_fptr(env->gwion, v->type)) - m_func = fptr_match(env, &ra); - else - m_func = func_match(env, &ra); + const Func m_func = !is_fptr(env->gwion, v->type) ? + func_match(env, &ra) :fptr_match(env, &ra); free_mstr(env->gwion->mp, tmpl_name); if(es.run) envset_pop(&es, v->from->owner_class);