Skip to content

Commit aec46f1

Browse files
petdanceSteve Hay
authored and
Steve Hay
committed
more embed cleanup
Message-ID: <[email protected]> (and run regen.pl) p4raw-id: //depot/perl@25156
1 parent 73beb80 commit aec46f1

14 files changed

+811
-431
lines changed

dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ char *
154154
Perl_sv_peek(pTHX_ SV *sv)
155155
{
156156
dVAR;
157-
SV *t = sv_newmortal();
157+
SV * const t = sv_newmortal();
158158
int unref = 0;
159159

160160
sv_setpvn(t, "", 0);

embed.fnc

Lines changed: 234 additions & 225 deletions
Large diffs are not rendered by default.

embed.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,8 @@
11721172
#define div128 S_div128
11731173
#define group_end S_group_end
11741174
#define get_num S_get_num
1175+
#define need_utf8 S_need_utf8
1176+
#define first_symbol S_first_symbol
11751177
#endif
11761178
#endif
11771179
#if defined(PERL_IN_PP_CTL_C) || defined(PERL_DECL_PROT)
@@ -1290,6 +1292,7 @@
12901292
#endif
12911293
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
12921294
#ifdef PERL_CORE
1295+
#define uiv_2buf S_uiv_2buf
12931296
#define asIV S_asIV
12941297
#define asUV S_asUV
12951298
#define sv_unglob S_sv_unglob
@@ -3152,6 +3155,8 @@
31523155
#define div128(a,b) S_div128(aTHX_ a,b)
31533156
#define group_end(a,b,c) S_group_end(aTHX_ a,b,c)
31543157
#define get_num(a,b) S_get_num(aTHX_ a,b)
3158+
#define need_utf8 S_need_utf8
3159+
#define first_symbol S_first_symbol
31553160
#endif
31563161
#endif
31573162
#if defined(PERL_IN_PP_CTL_C) || defined(PERL_DECL_PROT)
@@ -3271,6 +3276,7 @@
32713276
#endif
32723277
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
32733278
#ifdef PERL_CORE
3279+
#define uiv_2buf S_uiv_2buf
32743280
#define asIV(a) S_asIV(aTHX_ a)
32753281
#define asUV(a) S_asUV(aTHX_ a)
32763282
#define sv_unglob(a) S_sv_unglob(aTHX_ a)

hv.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ S_hsplit(pTHX_ HV *hv)
12611261

12621262
if (was_shared) {
12631263
/* Unshare it. */
1264-
HEK *new_hek
1264+
HEK * const new_hek
12651265
= save_hek_flags(HeKEY(entry), HeKLEN(entry),
12661266
hash, HeKFLAGS(entry));
12671267
unshare_hek (HeKEY_hek(entry));
@@ -1417,22 +1417,23 @@ Perl_newHVhv(pTHX_ HV *ohv)
14171417
/* It's an ordinary hash, so copy it fast. AMS 20010804 */
14181418
STRLEN i;
14191419
const bool shared = !!HvSHAREKEYS(ohv);
1420-
HE **ents, **oents = (HE **)HvARRAY(ohv);
1420+
HE **ents, ** const oents = (HE **)HvARRAY(ohv);
14211421
char *a;
14221422
Newx(a, PERL_HV_ARRAY_ALLOC_BYTES(hv_max+1), char);
14231423
ents = (HE**)a;
14241424

14251425
/* In each bucket... */
14261426
for (i = 0; i <= hv_max; i++) {
1427-
HE *prev = NULL, *ent = NULL, *oent = oents[i];
1427+
HE *prev = NULL, *ent = NULL;
1428+
HE *oent = oents[i];
14281429

14291430
if (!oent) {
14301431
ents[i] = NULL;
14311432
continue;
14321433
}
14331434

14341435
/* Copy the linked list of entries. */
1435-
for (oent = oents[i]; oent; oent = HeNEXT(oent)) {
1436+
for (; oent; oent = HeNEXT(oent)) {
14361437
const U32 hash = HeHASH(oent);
14371438
const char * const key = HeKEY(oent);
14381439
const STRLEN len = HeKLEN(oent);
@@ -1456,7 +1457,7 @@ Perl_newHVhv(pTHX_ HV *ohv)
14561457
HvFILL(hv) = hv_fill;
14571458
HvTOTALKEYS(hv) = HvTOTALKEYS(ohv);
14581459
HvARRAY(hv) = ents;
1459-
}
1460+
} /* not magical */
14601461
else {
14611462
/* Iterate over ohv, copying keys and values one at a time. */
14621463
HE *entry;
@@ -2176,7 +2177,7 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash)
21762177
bool found = 0;
21772178
bool is_utf8 = FALSE;
21782179
int k_flags = 0;
2179-
const char *save = str;
2180+
const char * const save = str;
21802181
struct shared_he *he = 0;
21812182

21822183
if (hek) {
@@ -2275,7 +2276,7 @@ Perl_share_hek(pTHX_ const char *str, I32 len, register U32 hash)
22752276
{
22762277
bool is_utf8 = FALSE;
22772278
int flags = 0;
2278-
const char *save = str;
2279+
const char * const save = str;
22792280

22802281
if (len < 0) {
22812282
STRLEN tmplen = -len;

mg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ Perl_vivify_defelem(pTHX_ SV *sv)
20202020
if ((I32)LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av))
20212021
LvTARG(sv) = Nullsv; /* array can't be extended */
20222022
else {
2023-
SV** svp = av_fetch(av, LvTARGOFF(sv), TRUE);
2023+
SV** const svp = av_fetch(av, LvTARGOFF(sv), TRUE);
20242024
if (!svp || (value = *svp) == &PL_sv_undef)
20252025
Perl_croak(aTHX_ PL_no_aelem, (I32)LvTARGOFF(sv));
20262026
}

op.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ Perl_Slab_Alloc(pTHX_ int m, size_t sz)
128128
void
129129
Perl_Slab_Free(pTHX_ void *op)
130130
{
131-
I32 **ptr = (I32 **) op;
132-
I32 *slab = ptr[-1];
131+
I32 ** const ptr = (I32 **) op;
132+
I32 * const slab = ptr[-1];
133133
assert( ptr-1 > (I32 **) slab );
134134
assert( ptr < ( (I32 **) slab + PERL_SLAB_SIZE) );
135135
assert( *slab > 0 );
@@ -3027,10 +3027,10 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
30273027

30283028
veop = Nullop;
30293029

3030-
if (version != Nullop) {
3030+
if (version) {
30313031
SV *vesv = ((SVOP*)version)->op_sv;
30323032

3033-
if (arg == Nullop && !SvNIOKp(vesv)) {
3033+
if (!arg && !SvNIOKp(vesv)) {
30343034
arg = version;
30353035
}
30363036
else {
@@ -4248,7 +4248,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
42484248
ps = Nullch;
42494249

42504250
if (!name && PERLDB_NAMEANON && CopLINE(PL_curcop)) {
4251-
SV *sv = sv_newmortal();
4251+
SV * const sv = sv_newmortal();
42524252
Perl_sv_setpvf(aTHX_ sv, "%s[%s:%"IVdf"]",
42534253
PL_curstash ? "__ANON__" : "__ANON__::__ANON__",
42544254
CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));

perl.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,9 +1685,8 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
16851685
argc--,argv++;
16861686
}
16871687
if (s && *s) {
1688-
char *p;
16891688
STRLEN len = strlen(s);
1690-
p = savepvn(s, len);
1689+
const char * const p = savepvn(s, len);
16911690
incpush(p, TRUE, TRUE, FALSE, FALSE);
16921691
sv_catpvn(sv, "-I", 2);
16931692
sv_catpvn(sv, p, len);
@@ -4452,10 +4451,10 @@ S_init_predump_symbols(pTHX)
44524451
void
44534452
Perl_init_argv_symbols(pTHX_ register int argc, register char **argv)
44544453
{
4455-
char *s;
44564454
argc--,argv++; /* skip name of script */
44574455
if (PL_doswitches) {
44584456
for (; argc > 0 && **argv == '-'; argc--,argv++) {
4457+
char *s;
44594458
if (!argv[0][1])
44604459
break;
44614460
if (argv[0][1] == '-' && !argv[0][2]) {
@@ -4475,7 +4474,7 @@ Perl_init_argv_symbols(pTHX_ register int argc, register char **argv)
44754474
(void)gv_AVadd(PL_argvgv);
44764475
av_clear(GvAVn(PL_argvgv));
44774476
for (; argc > 0; argc--,argv++) {
4478-
SV *sv = newSVpv(argv[0],0);
4477+
SV * const sv = newSVpv(argv[0],0);
44794478
av_push(GvAVn(PL_argvgv),sv);
44804479
if (!(PL_unicode & PERL_UNICODE_LOCALE_FLAG) || PL_utf8locale) {
44814480
if (PL_unicode & PERL_UNICODE_ARGV_FLAG)

pp_ctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,6 @@ PP(pp_redo)
22102210
STATIC OP *
22112211
S_dofindlabel(pTHX_ OP *o, const char *label, OP **opstack, OP **oplimit)
22122212
{
2213-
OP *kid = Nullop;
22142213
OP **ops = opstack;
22152214
static const char too_deep[] = "Target of goto is too deeply nested";
22162215

@@ -2228,6 +2227,7 @@ S_dofindlabel(pTHX_ OP *o, const char *label, OP **opstack, OP **oplimit)
22282227
}
22292228
*ops = 0;
22302229
if (o->op_flags & OPf_KIDS) {
2230+
OP *kid;
22312231
/* First try all the kids at this level, since that's likeliest. */
22322232
for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) {
22332233
if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) &&

pp_hot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2843,7 +2843,7 @@ Perl_sub_crush_depth(pTHX_ CV *cv)
28432843
if (CvANON(cv))
28442844
Perl_warner(aTHX_ packWARN(WARN_RECURSION), "Deep recursion on anonymous subroutine");
28452845
else {
2846-
SV* tmpstr = sv_newmortal();
2846+
SV* const tmpstr = sv_newmortal();
28472847
gv_efullname3(tmpstr, CvGV(cv), Nullch);
28482848
Perl_warner(aTHX_ packWARN(WARN_RECURSION), "Deep recursion on subroutine \"%"SVf"\"",
28492849
tmpstr);

pp_pack.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,6 @@ S_next_symbol(pTHX_ tempsym_t* symptr )
11161116
version of the string. Users are advised to upgrade their pack string
11171117
themselves if they need to do a lot of unpacks like this on it
11181118
*/
1119-
/* XXX These can be const */
11201119
STATIC bool
11211120
need_utf8(const char *pat, const char *patend)
11221121
{

0 commit comments

Comments
 (0)