use qsort_s on solaris feature/array

Wed, 07 Aug 2019 23:23:58 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 07 Aug 2019 23:23:58 +0200
branch
feature/array
changeset 348
3b9b4f6e9fd6
parent 347
62660a4875c9
child 349
05957b1d10a5

use qsort_s on solaris

src/array.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/array.c	Wed Aug 07 21:44:35 2019 +0200
     1.2 +++ b/src/array.c	Wed Aug 07 23:23:58 2019 +0200
     1.3 @@ -27,6 +27,8 @@
     1.4   */
     1.5  
     1.6  #define _GNU_SOURCE /* we want to use qsort_r(), if available */
     1.7 +#define __STDC_WANT_LIB_EXT1__ 1 /* use qsort_s, if available */
     1.8 +
     1.9  
    1.10  #include "ucx/array.h"
    1.11  #include "ucx/utils.h"
    1.12 @@ -42,7 +44,11 @@
    1.13  #elif /* not  __GLIBC__ */ defined(__APPLE__) || defined(__FreeBSD__)
    1.14  #define ucx_array_sort_impl ucx_qsort_r
    1.15  #define USE_UCX_QSORT_R
    1.16 -#endif /* __GLIBC__, __APLE__, __FreeBSD__ */
    1.17 +#elif /* not (__APPLE || __FreeBSD__) */ defined(__sun)
    1.18 +#if __STDC_VERSION__ >= 201112L
    1.19 +#define ucx_array_sort_impl qsort_s
    1.20 +#endif
    1.21 +#endif /* __GLIBC__, __APLE__, __FreeBSD__, __sun */
    1.22  #endif /* UCX_ARRAY_DISABLE_QSORT */
    1.23  
    1.24  #ifndef ucx_array_sort_impl
    1.25 @@ -298,7 +304,7 @@
    1.26  };
    1.27  
    1.28  static int cmp_func_swap_args(void *data, const void *x, const void *y) {
    1.29 -    struct cmpfnc_swapargs_info* info = data;
    1.30 +    cmpfnc_swapargs_info* info = data;
    1.31      return info->func(x, y, info->data);
    1.32  }
    1.33  

mercurial