]> Savannah Git Hosting - gnulib.git/commitdiff
search: Fix compilation errors with SunPRO C++ on Solaris 10.
authorBruno Haible <bruno@clisp.org>
Fri, 24 Dec 2021 15:51:31 +0000 (16:51 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 24 Dec 2021 15:51:31 +0000 (16:51 +0100)
* lib/search.in.h (_gl_lsearch_compar_fn): New type.
(lfind, lsearch): Use it.

ChangeLog
lib/search.in.h

index 43d28ec21395d47e07ab9bfb200e511c48069245..dba79b9082e3bd17fb820b49ec7d77842a3e050a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-12-24  Bruno Haible  <bruno@clisp.org>
+
+       search: Fix compilation errors with SunPRO C++ on Solaris 10.
+       * lib/search.in.h (_gl_lsearch_compar_fn): New type.
+       (lfind, lsearch): Use it.
+
 2021-12-24  Bruno Haible  <bruno@clisp.org>
 
        qsort_r: Fix compilation error with SunPRO C++ on Solaris 10.
index 02faf482daff3bd0b79f8a15ff6779b0e1258623..1935d8a97ed9fb6cf0bbec2cafad50ee9b413857 100644 (file)
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if !GNULIB_defined_lsearch_fn_types
+typedef int (*_gl_lsearch_compar_fn) (const void *, const void *);
+# define GNULIB_defined_lsearch_fn_types 1
+#endif
+#ifdef __cplusplus
+}
+#endif
+
 #if @GNULIB_MDA_LFIND@
 /* On native Windows, map 'lfind' to '_lfind', so that -loldnames is not
    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
 _GL_CXXALIAS_MDA (lfind, void *,
                   (const void *key, const void *base, unsigned int *nmemb,
                    unsigned int size,
-                   int (*compar) (const void *, const void *)));
+                   _gl_lsearch_compar_fn compar));
 # else
 _GL_CXXALIAS_SYS (lfind, void *,
                   (const void *key, const void *base, size_t *nmemb,
                    size_t size,
-                   int (*compar) (const void *, const void *)));
+                   _gl_lsearch_compar_fn compar));
 # endif
 _GL_CXXALIASWARN (lfind);
 #endif
@@ -72,12 +83,12 @@ _GL_CXXALIASWARN (lfind);
 _GL_CXXALIAS_MDA (lsearch, void *,
                   (const void *key, void *base, unsigned int *nmemb,
                    unsigned int size,
-                   int (*compar) (const void *, const void *)));
+                   _gl_lsearch_compar_fn compar));
 # else
 _GL_CXXALIAS_SYS (lsearch, void *,
                   (const void *key, void *base, size_t *nmemb,
                    size_t size,
-                   int (*compar) (const void *, const void *)));
+                   _gl_lsearch_compar_fn compar));
 # endif
 _GL_CXXALIASWARN (lsearch);
 #endif