diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-04-30 19:03:34 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-04-30 19:03:34 +0000 |
commit | 045ac3170cd33a7002e5d26e4859e94ca400926d (patch) | |
tree | bf481b2a683c7ccbf658d60a50623597b094923e /pp_sort.c | |
parent | e8c86ba6ca66f86dc4c8f4de0abf70f53c2484f4 (diff) | |
download | perl-045ac3170cd33a7002e5d26e4859e94ca400926d.tar.gz |
Fix bug id 20020427.004 on %^H.
Add a regression test for %^H.
Change the sort pragma implementation to use a
global variable instead of %^H.
p4raw-id: //depot/perl@16286
Diffstat (limited to 'pp_sort.c')
-rw-r--r-- | pp_sort.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -34,10 +34,9 @@ static I32 amagic_cmp_locale(pTHX_ SV *a, SV *b); #define sv_cmp_static Perl_sv_cmp #define sv_cmp_locale_static Perl_sv_cmp_locale -#define SORTHINTS(hintsvp) \ - ((PL_hintgv && \ - (hintsvp = hv_fetch(GvHV(PL_hintgv), "SORT", 4, FALSE))) ? \ - (I32)SvIV(*hintsvp) : 0) +#define SORTHINTS(hintsv) \ + (((hintsv) = GvSV(gv_fetchpv("sort::hints", GV_ADDMULTI, SVt_IV))), \ + (SvIOK(hintsv) ? ((I32)SvIV(hintsv)) : 0)) #ifndef SMALLSORT #define SMALLSORT (200) @@ -1304,9 +1303,9 @@ cmpindir(pTHX_ gptr a, gptr b) STATIC void S_qsortsv(pTHX_ gptr *list1, size_t nmemb, SVCOMPARE_t cmp) { - SV **hintsvp; + SV *hintsv; - if (SORTHINTS(hintsvp) & HINT_SORT_STABLE) { + if (SORTHINTS(hintsv) & HINT_SORT_STABLE) { register gptr **pp, *q; register size_t n, j, i; gptr *small[SMALLSORT], **indir, tmp; @@ -1391,7 +1390,7 @@ Perl_sortsv(pTHX_ SV **array, size_t nmemb, SVCOMPARE_t cmp) { void (*sortsvp)(pTHX_ SV **array, size_t nmemb, SVCOMPARE_t cmp) = S_mergesortsv; - SV **hintsvp; + SV *hintsv; I32 hints; /* Sun's Compiler (cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2) used @@ -1399,7 +1398,7 @@ Perl_sortsv(pTHX_ SV **array, size_t nmemb, SVCOMPARE_t cmp) errors related to picking the correct sort() function, try recompiling this file without optimiziation. -- A.D. 4/2002. */ - hints = SORTHINTS(hintsvp); + hints = SORTHINTS(hintsv); if (hints & HINT_SORT_QUICKSORT) { sortsvp = S_qsortsv; } |