Changeset 1154 for cpp/common


Ignore:
Timestamp:
10/01/21 22:39:55 (3 years ago)
Author:
Maciej Komosinski
Message:

Supported another variant of qsort()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd.h

    r1016 r1154  
    5757//How cool, gcc&clang: qsort_r(a,b), borland: qsort_s(a,b), visual: qsort_s(b,a)
    5858#ifdef __BORLANDC__
    59  #define qsort_r qsort_s
     59#define CALL_QSORT_R(base,nmemb,size,compar,context) qsort_s(base,nmemb,size,compar,context)
    6060#endif
    6161
    6262#ifdef _MSC_VER
    63  #define QSORT_R_USING_QSORT_S //qsort_r callers use this macro to adjust argument order in comparator, because microsoft and gcc&clang are incompatible here
    64  #define qsort_r(base,nmemb,size,compar,context) qsort_s((base),(nmemb),(size),(compar),(context))
     63 #define QSORT_R_THIS_FIRST //qsort_r callers use this macro to adjust argument order in comparator, because microsoft and gcc&clang are incompatible here
     64 #define CALL_QSORT_R(base,nmemb,size,compar,context) qsort_s((base),(nmemb),(size),(compar),(context))
     65#endif
     66
     67#if defined MACOS || defined IPHONE
     68//qsort_r(void *__base, size_t __nel, size_t __width, void *, int (* _Nonnull __compar)(void *, const void *, const void *));
     69#define QSORT_R_THIS_FIRST
     70#define CALL_QSORT_R(base,nmemb,size,compar,context) qsort_r(base,nmemb,size,context,compar)
     71#endif
     72
     73#ifndef CALL_QSORT_R
     74#define CALL_QSORT_R(base,nmemb,size,compar,context) qsort_r(base,nmemb,size,compar,context)
    6575#endif
    6676
Note: See TracChangeset for help on using the changeset viewer.