From 3f102c2270da6514d0f2ded62306ba59b374c5b1 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 12 Jun 2024 23:15:56 +0200 Subject: [PATCH] Use of memcmp instead of strcmp for string_equal_p --- m-string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/m-string.h b/m-string.h index aaee8b4d..e57b035a 100644 --- a/m-string.h +++ b/m-string.h @@ -682,7 +682,8 @@ m_string_equal_p(const m_string_t v1, const m_string_t v2) M_ASSERT(v1 != NULL); M_ASSERT(v2 != NULL); /* Optimization: both strings shall have at least the same size */ - return m_string_size(v1) == m_string_size(v2) && m_string_cmp(v1, v2) == 0; + return m_string_size(v1) == m_string_size(v2) + && memcmp(m_string_get_cstr(v1), m_string_get_cstr(v2), m_string_size(v1)) == 0; } /* Test if the string is equal to the C string