Simplifiest compare

This commit is contained in:
Devine Lu Linvega 2024-04-08 08:44:21 -07:00
parent d73bf177d5
commit 36f9bfdaee
1 changed files with 4 additions and 5 deletions

View File

@ -33,11 +33,10 @@ walk(char *s)
static int
compare(char *a, char *b)
{
int i = 0, al = walk(a) - a, bl = walk(b) - b;
if(al == bl)
while(a[i] == b[i])
if(!a[i] || ++i >= al) return 1;
return 0;
char *aa = walk(a), *bb = walk(b);
while(a < aa && b < bb)
if(*a++ != *b++) return 0;
return 1;
}
static void