From: Bruno Haible Date: Fri, 19 Sep 2025 22:03:51 +0000 (+0200) Subject: stringeq: Fix use in C++ mode. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc1dc5630e1ff1f191f9a1c51ea0c376958c913b;p=thirdparty%2Fgnulib.git stringeq: Fix use in C++ mode. * lib/string.in.h (memeq, streq): Define with "C" linkage. --- diff --git a/ChangeLog b/ChangeLog index ae028184da..0e2d542ce4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-09-19 Bruno Haible + + stringeq: Fix use in C++ mode. + * lib/string.in.h (memeq, streq): Define with "C" linkage. + 2025-09-19 Bruno Haible map-c++-tests: Fix compilation error (regression 2025-09-17). diff --git a/lib/string.in.h b/lib/string.in.h index 2c941d08f4..fdcdd21bed 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -417,11 +417,17 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " /* Are S1 and S2, of size N, bytewise equal? */ #if @GNULIB_STRINGEQ@ && !@HAVE_DECL_MEMEQ@ +# ifdef __cplusplus +extern "C" { +# endif _GL_STRING_INLINE bool memeq (void const *__s1, void const *__s2, size_t __n) { return !memcmp (__s1, __s2, __n); } +# ifdef __cplusplus +} +# endif #endif /* Return the first occurrence of NEEDLE in HAYSTACK. */ @@ -806,11 +812,17 @@ _GL_CXXALIASWARN (strdup); /* Are strings S1 and S2 equal? */ #if @GNULIB_STRINGEQ@ && !@HAVE_DECL_STREQ@ +# ifdef __cplusplus +extern "C" { +# endif _GL_STRING_INLINE bool streq (char const *__s1, char const *__s2) { return !strcmp (__s1, __s2); } +# ifdef __cplusplus +} +# endif #endif /* Append no more than N characters from SRC onto DEST. */