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;
#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);
}