Change 29997 by [EMAIL PROTECTED] on 2007/01/26 10:30:23
Integrate:
[ 28381]
Subject: [PATCH] Proper use of enums
From: [EMAIL PROTECTED] (Andy Lester)
Date: Sun, 11 Jun 2006 22:44:34 -0500
Message-ID: <[EMAIL PROTECTED]>
[ 28385]
Subject: [PATCH] Static cleanup in pp_sort.c
From: [EMAIL PROTECTED] (Andy Lester)
Date: Mon, 12 Jun 2006 08:59:34 -0500
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/maint-5.8/perl/embed.fnc#195 integrate
... //depot/maint-5.8/perl/embed.h#147 integrate
... //depot/maint-5.8/perl/gv.c#94 integrate
... //depot/maint-5.8/perl/op.c#183 integrate
... //depot/maint-5.8/perl/perlio.c#95 integrate
... //depot/maint-5.8/perl/pod/perlapi.pod#92 integrate
... //depot/maint-5.8/perl/pp.c#129 integrate
... //depot/maint-5.8/perl/pp_sort.c#45 integrate
... //depot/maint-5.8/perl/proto.h#185 integrate
... //depot/maint-5.8/perl/sv.c#322 integrate
... //depot/maint-5.8/perl/sv.h#75 integrate
Differences ...
==== //depot/maint-5.8/perl/embed.fnc#195 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#194~29996~ 2007-01-26 01:54:13.000000000 -0800
+++ perl/embed.fnc 2007-01-26 02:30:23.000000000 -0800
@@ -1225,6 +1225,7 @@
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)
==== //depot/maint-5.8/perl/embed.h#147 (text+w) ====
Index: perl/embed.h
--- perl/embed.h#146~29996~ 2007-01-26 01:54:13.000000000 -0800
+++ perl/embed.h 2007-01-26 02:30:23.000000000 -0800
@@ -1242,6 +1242,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)
@@ -3331,6 +3332,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)
==== //depot/maint-5.8/perl/gv.c#94 (text) ====
Index: perl/gv.c
--- perl/gv.c#93~29995~ 2007-01-26 01:31:24.000000000 -0800
+++ perl/gv.c 2007-01-26 02:30:23.000000000 -0800
@@ -195,6 +195,7 @@
case SVt_PVIO:
Perl_croak(aTHX_ "Cannot convert a reference to %s to typeglob",
sv_reftype(has_constant, 0));
+ default: NOOP;
}
SvRV_set(gv, NULL);
SvROK_off(gv);
==== //depot/maint-5.8/perl/op.c#183 (text) ====
Index: perl/op.c
--- perl/op.c#182~29985~ 2007-01-25 14:55:28.000000000 -0800
+++ perl/op.c 2007-01-26 02:30:23.000000000 -0800
@@ -5317,21 +5317,21 @@
/* Is it a constant from cv_const_sv()? */
if (SvROK(kidsv) && SvREADONLY(kidsv)) {
SV * const rsv = SvRV(kidsv);
- const int svtype = SvTYPE(rsv);
+ const svtype type = SvTYPE(rsv);
const char *badtype = NULL;
switch (o->op_type) {
case OP_RV2SV:
- if (svtype > SVt_PVMG)
+ if (type > SVt_PVMG)
badtype = "a SCALAR";
break;
case OP_RV2AV:
- if (svtype != SVt_PVAV)
+ if (type != SVt_PVAV)
badtype = "an ARRAY";
break;
case OP_RV2HV:
- if (svtype != SVt_PVHV) {
- if (svtype == SVt_PVAV) { /* pseudohash? */
+ if (type != SVt_PVHV) {
+ if (type == SVt_PVAV) { /* pseudohash? */
SV **ksv = av_fetch((AV*)rsv, 0, FALSE);
if (ksv && SvROK(*ksv)
&& SvTYPE(SvRV(*ksv)) == SVt_PVHV)
@@ -5343,7 +5343,7 @@
}
break;
case OP_RV2CV:
- if (svtype != SVt_PVCV)
+ if (type != SVt_PVCV)
badtype = "a CODE";
break;
}
==== //depot/maint-5.8/perl/perlio.c#95 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#94~29993~ 2007-01-26 01:15:17.000000000 -0800
+++ perl/perlio.c 2007-01-26 02:30:23.000000000 -0800
@@ -1440,8 +1440,9 @@
return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Code"), 0);
case SVt_PVGV:
return PerlIO_find_layer(aTHX_ STR_WITH_LEN("Glob"), 0);
+ default:
+ return NULL;
}
- return NULL;
}
PerlIO_list_t *
==== //depot/maint-5.8/perl/pp.c#129 (text) ====
Index: perl/pp.c
--- perl/pp.c#128~29985~ 2007-01-25 14:55:28.000000000 -0800
+++ perl/pp.c 2007-01-26 02:30:23.000000000 -0800
@@ -234,6 +234,7 @@
case SVt_PVHV:
case SVt_PVCV:
DIE(aTHX_ "Not a SCALAR reference");
+ default: NOOP;
}
}
else {
==== //depot/maint-5.8/perl/pp_sort.c#45 (text) ====
Index: perl/pp_sort.c
--- perl/pp_sort.c#44~29964~ 2007-01-24 15:53:28.000000000 -0800
+++ perl/pp_sort.c 2007-01-26 02:30:23.000000000 -0800
@@ -1361,8 +1361,10 @@
PL_sort_RealCmp = cmp; /* Put comparison routine where cmpindir can
find it */
/* sort, with indirection */
- S_qsortsvu(aTHX_ (gptr *)indir, nmemb,
- flags ? cmpindir_desc : cmpindir);
+ if (flags)
+ qsortsvu((gptr *)indir, nmemb, cmpindir_desc);
+ else
+ qsortsvu((gptr *)indir, nmemb, cmpindir);
pp = indir;
q = list1;
@@ -1409,11 +1411,11 @@
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);
}
}
==== //depot/maint-5.8/perl/proto.h#185 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#184~29996~ 2007-01-26 01:54:13.000000000 -0800
+++ perl/proto.h 2007-01-26 02:30:23.000000000 -0800
@@ -1798,6 +1798,7 @@
STATIC I32 S_sortcv(pTHX_ SV *a, SV *b);
STATIC I32 S_sortcv_xsub(pTHX_ SV *a, SV *b);
STATIC I32 S_sortcv_stacked(pTHX_ SV *a, SV *b);
+STATIC void S_qsortsvu(pTHX_ SV** array, size_t num_elts, SVCOMPARE_t
compare);
#endif
#if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT)
==== //depot/maint-5.8/perl/sv.c#322 (text) ====
Index: perl/sv.c
--- perl/sv.c#321~29995~ 2007-01-26 01:31:24.000000000 -0800
+++ perl/sv.c 2007-01-26 02:30:23.000000000 -0800
@@ -1099,7 +1099,7 @@
{
void* old_body;
void* new_body;
- U32 old_type = SvTYPE(sv);
+ const U32 old_type = SvTYPE(sv);
const struct body_details *new_type_details;
const struct body_details *const old_type_details
= bodies_by_type + old_type;
@@ -1472,6 +1472,7 @@
case SVt_PVIO:
Perl_croak(aTHX_ "Can't coerce %s to integer in %s", sv_reftype(sv,0),
OP_DESC(PL_op));
+ default: NOOP;
}
(void)SvIOK_only(sv); /* validate number */
SvIV_set(sv, i);
@@ -1571,6 +1572,7 @@
case SVt_PVIO:
Perl_croak(aTHX_ "Can't coerce %s to number in %s", sv_reftype(sv,0),
OP_NAME(PL_op));
+ default: NOOP;
}
SvNV_set(sv, num);
(void)SvNOK_only(sv); /* validate number */
@@ -3242,7 +3244,7 @@
{
register U32 sflags;
register int dtype;
- register int stype;
+ register svtype stype;
if (sstr == dstr)
return;
==== //depot/maint-5.8/perl/sv.h#75 (text) ====
Index: perl/sv.h
--- perl/sv.h#74~29988~ 2007-01-25 15:24:46.000000000 -0800
+++ perl/sv.h 2007-01-26 02:30:23.000000000 -0800
@@ -260,7 +260,7 @@
#define SvREFCNT_dec(sv) sv_free((SV*)(sv))
#define SVTYPEMASK 0xff
-#define SvTYPE(sv) ((sv)->sv_flags & SVTYPEMASK)
+#define SvTYPE(sv) (svtype)((sv)->sv_flags & SVTYPEMASK)
/* Sadly there are some parts of the core that have pointers to already-freed
SV heads, and rely on being able to tell that they are now free. So mark
End of Patch.