From b2502c4ab1558e1e37d4468f4b326bcd49cd5d56 Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Fri, 10 Jul 2026 04:08:28 +0000 Subject: [PATCH] spkg: strlib: Add RtlStrEq() function Signed-off-by: Chloe M. --- service/spkg/head/string.h | 10 ++++++++++ service/spkg/strlib/streq.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 service/spkg/strlib/streq.c diff --git a/service/spkg/head/string.h b/service/spkg/head/string.h index 43adfa7..d172524 100644 --- a/service/spkg/head/string.h +++ b/service/spkg/head/string.h @@ -29,4 +29,14 @@ USIZE RtlStrLen(const CHAR *String); */ LONG RtlMemCmp(const VOID *Buffer1, const VOID *Buffer2, USIZE Length); +/* + * Check if two strings are equal + * + * @String1: First string to compare + * @String2: Second string to compare + * + * Returns true if the two strings are equal + */ +BOOLEAN RtlStrEq(const CHAR *String1, const CHAR *String2); + #endif /* !_SPKG_STRING_H_ */ diff --git a/service/spkg/strlib/streq.c b/service/spkg/strlib/streq.c new file mode 100644 index 0000000..62e9db4 --- /dev/null +++ b/service/spkg/strlib/streq.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2026, Chloe M., et al + * Provided under the BSD-3 clause. + * + * Description: Check if two strings are equal + * Author: Chloe M. + */ + +#include +#include + +BOOLEAN +RtlStrEq(const CHAR *String1, const CHAR *String2) +{ + if (String1 == NULL || String2 == NULL) { + return false; + } + + while (*String1 != '\0' && *String2 != '\0') { + if (*String1++ != *String2++) { + return false; + } + } + + if (*String1 != *String2) { + return false; + } + + return true; +}