From 36f9bfdaeefbd80e472cf6ef774a6289a7a92fcf Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 8 Apr 2024 08:44:21 -0700 Subject: [PATCH] Simplifiest compare --- src/modal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modal.c b/src/modal.c index e1c8e80..f54c9ac 100644 --- a/src/modal.c +++ b/src/modal.c @@ -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