Fixed a bug with the two string equals functions

This commit is contained in:
Eric-Paul Ickhorn 2023-12-14 22:03:32 +01:00
parent c8ae7a57d1
commit 5e00c669c6
Signed by: epickh
GPG Key ID: F5EBBE013924D95F
1 changed files with 4 additions and 0 deletions

View File

@ -12,7 +12,10 @@ bool_t rr_strings_equal(const char *string1, const char *string2)
{ {
usz_t index = 0; usz_t index = 0;
while(string1[index] == string2[index]) while(string1[index] == string2[index])
{
if(string1[index] == ZERO) return TRUE; if(string1[index] == ZERO) return TRUE;
++index;
}
return FALSE; return FALSE;
} }
@ -23,6 +26,7 @@ bool_t rr_strings_equal_up_to(const char *string1, const char *string2, usz_t ma
{ {
if(string1[index] == ZERO) return TRUE; if(string1[index] == ZERO) return TRUE;
if(index >= max_length) return TRUE; if(index >= max_length) return TRUE;
++index;
} }
return FALSE; return FALSE;
} }