From: Jérémie Astor Date: Tue, 30 Mar 2021 08:18:13 +0000 (+0200) Subject: :art: Improve dym X-Git-Tag: nightly~809 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e55d15dfc9c8efa5b21683cf610cd3ddf7459a98;p=gwion.git :art: Improve dym --- diff --git a/src/parse/did_you_mean.c b/src/parse/did_you_mean.c index e2d4e784..63819fad 100644 --- a/src/parse/did_you_mean.c +++ b/src/parse/did_you_mean.c @@ -32,12 +32,10 @@ static m_bool wagner_fisher(const char *s, const char* t) { return (i && j && d[m-1][n-1] < MAX_DISTANCE); } -ANN static void ressembles(const Vector v, const Nspc nspc, const char* name, bool *const done) { +ANN static void ressembles(const Nspc nspc, const char* name, bool *const done) { struct scope_iter iter = { nspc->info->value, 0, 0 }; Value value; while(scope_iter(&iter, &value) > 0) { - if(vector_find(v, (vtype)value->name) > 0 &&!strcmp(name, value->name)) - continue; if(wagner_fisher(name, value->name)) { if(!*done) { *done = true; @@ -55,22 +53,15 @@ ANN static void ressembles(const Vector v, const Nspc nspc, const char* name, bo #undef did_you_mean_nspc ANN void did_you_mean_nspc(Nspc nspc, const char* name) { CHECK_LEN(name) - struct Vector_ v; - vector_init(&v); bool done; - do ressembles(&v, nspc, name, &done); + do ressembles(nspc, name, &done); while((nspc = nspc->parent)); - vector_release(&v); } #undef did_you_mean_type ANN void did_you_mean_type(Type type, const char* name) { CHECK_LEN(name) - Type t = type; - struct Vector_ v; - vector_init(&v); bool done; - do ressembles(&v, t->nspc, name, &done); - while((t = t->info->parent) && t->nspc); - vector_release(&v); + do ressembles(type->nspc, name, &done); + while((type = type->info->parent) && type->nspc); }