slen() is not needed to get lenght of rule data

This commit is contained in:
Devine Lu Linvega 2024-05-21 20:09:15 -07:00
parent 170cfde437
commit 44b04fa893
1 changed files with 1 additions and 10 deletions

View File

@ -22,15 +22,6 @@ copy(char *src, char *dst, int length)
return dst; return dst;
} }
static int
slen(char *s)
{
char *cap = s;
while(*cap++)
;
return cap - s;
}
static char * static char *
walk(char *s) walk(char *s)
{ {
@ -272,8 +263,8 @@ static void
remove_rule(Rule *r) remove_rule(Rule *r)
{ {
if(r < rules_ - 1) { if(r < rules_ - 1) {
int distance = slen(r->a) + slen(r->b);
char *memsrc = (r + 1)->a; char *memsrc = (r + 1)->a;
int distance = (r + 1)->a - r->a;
copy(memsrc, r->a, dict_ - memsrc); copy(memsrc, r->a, dict_ - memsrc);
while(r < rules_ - 1) { while(r < rules_ - 1) {
Rule *next = r + 1; Rule *next = r + 1;