From: ceriel Date: Wed, 22 Jun 1988 16:22:07 +0000 (+0000) Subject: distance routine improved a little; still not safe! X-Git-Tag: release-5-5~3168 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c146e278fcdfb7b298d79379fe626566384eba49;p=ack.git distance routine improved a little; still not safe! --- diff --git a/mach/proto/ncg/subr.c b/mach/proto/ncg/subr.c index 957ac974b..addea1ff3 100644 --- a/mach/proto/ncg/subr.c +++ b/mach/proto/ncg/subr.c @@ -282,6 +282,7 @@ distance(cindex) { int tokexp,tpl; int expsize,toksize,exact; int xsekt=0; + int fromstackneeded=0; bp = &coderules[cindex]; #ifndef NDEBUG @@ -305,6 +306,7 @@ distance(cindex) { if (stackheight < tpl) { if (xsekt) return(MAXINT); + fromstackneeded = tpl - stackheight; tpl = stackheight; } else if (stackheight != tpl && xsekt==2) @@ -325,12 +327,12 @@ distance(cindex) { } else exact++; } - if (exact==tpl) { + if (exact==tpl && ! fromstackneeded) { if (xsekt) return(0); return(10-exact); } - return(20-exact); + return(20-exact+fromstackneeded); } unsigned costcalc(cost) cost_t cost; {