summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Beckett <dave@dajobe.org>2023-03-19 17:08:54 -0700
committerGitHub <noreply@github.com>2023-03-19 17:08:54 -0700
commit5f469c38d378c1291fba6d9d65741f7daf220db6 (patch)
tree6c793f93f7bfbdbc32d539765ab51e514fbc94ec
parent53e6b5e807a0367ba14efc8f3b7afaffa9a3bcf3 (diff)
parentb89753f6ea9fd2b7a00ec19fec0ceead264c40f8 (diff)
downloadraptor-5f469c38d378c1291fba6d9d65741f7daf220db6.tar.gz
Merge pull request #57 from 0-wiz-0/sunos-fixes
Fix build on SunOS
-rw-r--r--src/sort_r.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sort_r.h b/src/sort_r.h
index 8d8b580b..cfbde7f4 100644
--- a/src/sort_r.h
+++ b/src/sort_r.h
@@ -30,6 +30,8 @@ void sort_r(void *base, size_t nel, size_t width,
defined __linux__ || defined __MINGW32__ || defined __GLIBC__ || \
defined __CYGWIN__)
# define _SORT_R_LINUX
+#elif defined __sun
+# define _SORT_R_SUN
#elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__)
# define _SORT_R_WINDOWS
#else
@@ -87,6 +89,11 @@ void sort_r(void *base, size_t nel, size_t width,
__compar_d_fn_t __compar, void *arg)
__attribute__((nonnull (1, 4)));
+ #elif defined _SORT_R_SUN
+
+ extern void qsort_r(void *base, size_t nel, size_t width,
+ int (*compar_arg)(const void *, const void *, void *), void *arg);
+
#endif
/* implementation */
@@ -106,6 +113,10 @@ void sort_r(void *base, size_t nel, size_t width,
tmp.compar = compar;
qsort_r(base, nel, width, &tmp, sort_r_arg_swap);
+ #elif defined _SORT_R_SUN
+
+ qsort_r(base, nel, width, compar, arg);
+
#else /* defined _SORT_R_WINDOWS */
struct sort_r_data tmp;
@@ -121,5 +132,6 @@ void sort_r(void *base, size_t nel, size_t width,
#undef _SORT_R_WINDOWS
#undef _SORT_R_LINUX
#undef _SORT_R_BSD
+#undef _SORT_R_SUN
#endif /* SORT_R_H_ */