raptor2: add SunOS support

This commit is contained in:
tnn 2022-04-12 13:20:05 +00:00
parent 9eb94102f9
commit 33e6c454ab
2 changed files with 47 additions and 1 deletions

View file

@ -1,5 +1,6 @@
$NetBSD: distinfo,v 1.13 2021/10/26 11:23:19 nia Exp $
$NetBSD: distinfo,v 1.14 2022/04/12 13:20:05 tnn Exp $
BLAKE2s (raptor2-2.0.15.tar.gz) = c24882035b615e21fd5ece74be5a565ee7a2dcd6f17619f18143e28727447759
SHA512 (raptor2-2.0.15.tar.gz) = 563dd01869eb4df8524ec12e2c0a541653874dcd834bd1eb265bc2943bb616968f624121d4688579cdce11b4f00a8ab53b7099f1a0850e256bb0a2c16ba048ee
Size (raptor2-2.0.15.tar.gz) = 1886657 bytes
SHA1 (patch-src_sort__r.h) = 88d24885b841afe13c509870ed9f16229e8badc4

View file

@ -0,0 +1,45 @@
$NetBSD: patch-src_sort__r.h,v 1.1 2022/04/12 13:20:05 tnn Exp $
SunOS support
--- src/sort_r.h.orig 2014-10-09 23:00:44.000000000 +0000
+++ src/sort_r.h
@@ -29,6 +29,8 @@ void sort_r(void *base, size_t nel, size
#elif (defined _GNU_SOURCE || defined __gnu_hurd__ || defined __GNU__ || \
defined __linux__ || defined __MINGW32__ || defined __GLIBC__)
# define _SORT_R_LINUX
+#elif defined __sun
+# define _SORT_R_SUN
#elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__)
# define _SORT_R_WINDOWS
#else
@@ -86,6 +88,11 @@ void sort_r(void *base, size_t nel, size
__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 */
@@ -105,6 +112,10 @@ void sort_r(void *base, size_t nel, size
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;
@@ -120,5 +131,6 @@ void sort_r(void *base, size_t nel, size
#undef _SORT_R_WINDOWS
#undef _SORT_R_LINUX
#undef _SORT_R_BSD
+#undef _SORT_R_SUN
#endif /* SORT_R_H_ */