From b7523199e9199934df128994a140c1da57ff0070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nilso=20J=C3=BAnior?= <162613094+nilsojunior@users.noreply.github.com> Date: Tue, 28 Apr 2026 13:32:05 -0300 Subject: [PATCH] [rtext] Remove `strcmp()` dependency --- src/rtext.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/rtext.c b/src/rtext.c index a3ec016f5..675317ff6 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -59,7 +59,7 @@ #include // Required for: malloc(), free() #include // Required for: vsprintf() -#include // Required for: strcmp(), strstr(), strncpy() [Used in TextReplace()], sscanf() [Used in LoadBMFont()] +#include // Required for: strstr(), strncpy() [Used in TextReplace()], sscanf() [Used in LoadBMFont()] #include // Required for: va_list, va_start(), vsprintf(), va_end() [Used in TextFormat()] #include // Required for: toupper(), tolower() [Used in TextToUpper(), TextToLower()] @@ -1675,14 +1675,19 @@ int TextCopy(char *dst, const char *src) } // Check if two text strings are equal -// REQUIRES: strcmp() +// NOTE: Alternative implementation to strcmp(s1, s2) from C standard library bool TextIsEqual(const char *text1, const char *text2) { bool result = false; if ((text1 != NULL) && (text2 != NULL)) { - if (strcmp(text1, text2) == 0) result = true; + while ((*text1 != '\0') && (*text1 == *text2)) + { + text1++; + text2++; + } + if (*text1 == *text2) result = true; } return result;