Static cleanup in pp_sort.c
Andy Lester [Mon, 12 Jun 2006 08:59:34 +0000 (03:59 -0500)]
Message-ID: <20060612135934.GA2202@petdance.com>

p4raw-id: //depot/perl@28385

embed.fnc
embed.h
pp_sort.c
proto.h

index e04236f..4ffa057 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -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)
diff --git a/embed.h b/embed.h
index 2885e22..95b2de2 100644 (file)
--- a/embed.h
+++ b/embed.h
 #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)
 #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)
index ab383c1..f349c6f 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -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);
     }
 }
 
diff --git a/proto.h b/proto.h
index 8bfa8c6..a0d5dec 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -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)