diff options
-rw-r--r-- | embed.fnc | 1 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | pp_sort.c | 10 | ||||
-rw-r--r-- | proto.h | 4 |
4 files changed, 13 insertions, 4 deletions
@@ -1275,6 +1275,7 @@ s |I32 |amagic_cmp_locale|NN SV *a|NN SV *b s |I32 |sortcv |NN SV *a|NN SV *b s |I32 |sortcv_xsub |NN SV *a|NN SV *b s |I32 |sortcv_stacked |NN SV *a|NN SV *b +s |void |qsortsvu |NN SV** array|size_t num_elts|NN SVCOMPARE_t compare #endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) @@ -1280,6 +1280,7 @@ #define sortcv S_sortcv #define sortcv_xsub S_sortcv_xsub #define sortcv_stacked S_sortcv_stacked +#define qsortsvu S_qsortsvu #endif #endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) @@ -3460,6 +3461,7 @@ #define sortcv(a,b) S_sortcv(aTHX_ a,b) #define sortcv_xsub(a,b) S_sortcv_xsub(aTHX_ a,b) #define sortcv_stacked(a,b) S_sortcv_stacked(aTHX_ a,b) +#define qsortsvu(a,b,c) S_qsortsvu(aTHX_ a,b,c) #endif #endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) @@ -1365,8 +1365,10 @@ S_qsortsv(pTHX_ gptr *list1, size_t nmemb, SVCOMPARE_t cmp, U32 flags) PL_sort_RealCmp = cmp; /* Put comparison routine where cmpindir can find it */ /* sort, with indirection */ - S_qsortsvu(aTHX_ (gptr *)indir, nmemb, - ((flags & SORTf_DESC) != 0 ? cmpindir_desc : cmpindir)); + if (flags & SORTf_DESC) + qsortsvu((gptr *)indir, nmemb, cmpindir_desc); + else + qsortsvu((gptr *)indir, nmemb, cmpindir); pp = indir; q = list1; @@ -1413,11 +1415,11 @@ S_qsortsv(pTHX_ gptr *list1, size_t nmemb, SVCOMPARE_t cmp, U32 flags) const SVCOMPARE_t savecmp = PL_sort_RealCmp; /* Save current comparison routine, if any */ PL_sort_RealCmp = cmp; /* Put comparison routine where cmp_desc can find it */ cmp = cmp_desc; - S_qsortsvu(aTHX_ list1, nmemb, cmp); + qsortsvu(list1, nmemb, cmp); /* restore prevailing comparison routine */ PL_sort_RealCmp = savecmp; } else { - S_qsortsvu(aTHX_ list1, nmemb, cmp); + qsortsvu(list1, nmemb, cmp); } } @@ -3488,6 +3488,10 @@ STATIC I32 S_sortcv_stacked(pTHX_ SV *a, SV *b) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); +STATIC void S_qsortsvu(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t compare) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_3); + #endif #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT) |