]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
stringeq: Fix use in C++ mode.
authorBruno Haible <bruno@clisp.org>
Fri, 19 Sep 2025 22:03:51 +0000 (00:03 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 19 Sep 2025 22:03:51 +0000 (00:03 +0200)
* lib/string.in.h (memeq, streq): Define with "C" linkage.

ChangeLog
lib/string.in.h

index ae028184da6fdf744be1b2667316135dbb2090a9..0e2d542ce4866a44b250b2ab3b189bdf67facc2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-09-19  Bruno Haible  <bruno@clisp.org>
+
+       stringeq: Fix use in C++ mode.
+       * lib/string.in.h (memeq, streq): Define with "C" linkage.
+
 2025-09-19  Bruno Haible  <bruno@clisp.org>
 
        map-c++-tests: Fix compilation error (regression 2025-09-17).
index 2c941d08f4f1be780109c12a0d1a970fe5d25283..fdcdd21bed657284fc8d5f8794be6eeb449b63ca 100644 (file)
@@ -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.  */