Skip to content

Commit 6136c70

Browse files
petdancergs
authored andcommitted
It's the Barbie bus patch
Message-ID: <[email protected]> p4raw-id: //depot/perl@26764
1 parent b77de8c commit 6136c70

21 files changed

+260
-298
lines changed

av.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ Perl_newAV(pTHX)
367367
sv_upgrade((SV *)av, SVt_PVAV);
368368
/* sv_upgrade does AvREAL_only() */
369369
AvALLOC(av) = 0;
370-
SvPV_set(av, (char*)0);
370+
SvPV_set(av, NULL);
371371
AvMAX(av) = AvFILLp(av) = -1;
372372
return av;
373373
}
@@ -482,7 +482,7 @@ Perl_av_undef(pTHX_ register AV *av)
482482
}
483483
Safefree(AvALLOC(av));
484484
AvALLOC(av) = 0;
485-
SvPV_set(av, (char*)0);
485+
SvPV_set(av, NULL);
486486
AvMAX(av) = AvFILLp(av) = -1;
487487
}
488488

doio.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ Perl_do_aexec5(pTHX_ SV *really, register SV **mark, register SV **sp,
13811381
#else
13821382
if (sp > mark) {
13831383
char **a;
1384-
const char *tmps = Nullch;
1384+
const char *tmps = NULL;
13851385
Newx(PL_Argv, sp - mark + 1, char*);
13861386
a = PL_Argv;
13871387

@@ -1391,7 +1391,7 @@ Perl_do_aexec5(pTHX_ SV *really, register SV **mark, register SV **sp,
13911391
else
13921392
*a++ = "";
13931393
}
1394-
*a = Nullch;
1394+
*a = NULL;
13951395
if (really)
13961396
tmps = SvPV_nolen_const(really);
13971397
if ((!really && *PL_Argv[0] != '/') ||
@@ -1544,7 +1544,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
15441544
if (*s)
15451545
*s++ = '\0';
15461546
}
1547-
*a = Nullch;
1547+
*a = NULL;
15481548
if (PL_Argv[0]) {
15491549
PERL_FPU_PRE_EXEC
15501550
PerlProc_execvp(PL_Argv[0],PL_Argv);
@@ -1553,15 +1553,13 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
15531553
do_execfree();
15541554
goto doshell;
15551555
}
1556-
{
1557-
if (ckWARN(WARN_EXEC))
1558-
Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't exec \"%s\": %s",
1559-
PL_Argv[0], Strerror(errno));
1560-
if (do_report) {
1561-
const int e = errno;
1562-
PerlLIO_write(fd, (void*)&e, sizeof(int));
1563-
PerlLIO_close(fd);
1564-
}
1556+
if (ckWARN(WARN_EXEC))
1557+
Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't exec \"%s\": %s",
1558+
PL_Argv[0], Strerror(errno));
1559+
if (do_report) {
1560+
const int e = errno;
1561+
PerlLIO_write(fd, (const void*)&e, sizeof(int));
1562+
PerlLIO_close(fd);
15651563
}
15661564
}
15671565
do_execfree();

embed.fnc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,6 @@ ERs |bool |reginclass |NN const regnode *n|NN const U8 *p|NULLOK STRLEN *lenp\
12781278
|bool do_utf8sv_is_utf8
12791279
Es |CHECKPOINT|regcppush |I32 parenfloor
12801280
Es |char*|regcppop
1281-
Es |char*|regcp_set_to |I32 ss
12821281
Es |void |cache_re |NN regexp *prog
12831282
ERs |U8* |reghop |NN U8 *pos|I32 off
12841283
ERs |U8* |reghop3 |NN U8 *pos|I32 off|NN U8 *lim

embed.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,6 @@
13031303
#define reginclass S_reginclass
13041304
#define regcppush S_regcppush
13051305
#define regcppop S_regcppop
1306-
#define regcp_set_to S_regcp_set_to
13071306
#define cache_re S_cache_re
13081307
#define reghop S_reghop
13091308
#define reghop3 S_reghop3
@@ -3343,7 +3342,6 @@
33433342
#define reginclass(a,b,c,d) S_reginclass(aTHX_ a,b,c,d)
33443343
#define regcppush(a) S_regcppush(aTHX_ a)
33453344
#define regcppop() S_regcppop(aTHX)
3346-
#define regcp_set_to(a) S_regcp_set_to(aTHX_ a)
33473345
#define cache_re(a) S_cache_re(aTHX_ a)
33483346
#define reghop(a,b) S_reghop(aTHX_ a,b)
33493347
#define reghop3(a,b,c) S_reghop3(aTHX_ a,b,c)

gv.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,20 +435,20 @@ Perl_gv_fetchmeth_autoload(pTHX_ HV *stash, const char *name, STRLEN len, I32 le
435435
GV **gvp;
436436

437437
if (!stash)
438-
return Nullgv; /* UNIVERSAL::AUTOLOAD could cause trouble */
438+
return NULL; /* UNIVERSAL::AUTOLOAD could cause trouble */
439439
if (len == S_autolen && strnEQ(name, S_autoload, S_autolen))
440-
return Nullgv;
440+
return NULL;
441441
if (!(gv = gv_fetchmeth(stash, S_autoload, S_autolen, FALSE)))
442-
return Nullgv;
442+
return NULL;
443443
cv = GvCV(gv);
444444
if (!(CvROOT(cv) || CvXSUB(cv)))
445-
return Nullgv;
445+
return NULL;
446446
/* Have an autoload */
447447
if (level < 0) /* Cannot do without a stub */
448448
gv_fetchmeth(stash, name, len, 0);
449449
gvp = (GV**)hv_fetch(stash, name, len, (level >= 0));
450450
if (!gvp)
451-
return Nullgv;
451+
return NULL;
452452
return *gvp;
453453
}
454454
return gv;
@@ -1458,9 +1458,9 @@ Perl_Gv_AMupdate(pTHX_ HV *stash)
14581458
for (i = 1; i < lim; i++)
14591459
amt.table[i] = Nullcv;
14601460
for (; i < NofAMmeth; i++) {
1461-
const char *cooky = PL_AMG_names[i];
1461+
const char * const cooky = PL_AMG_names[i];
14621462
/* Human-readable form, for debugging: */
1463-
const char *cp = (i >= DESTROY_amg ? cooky : AMG_id2name(i));
1463+
const char * const cp = (i >= DESTROY_amg ? cooky : AMG_id2name(i));
14641464
const STRLEN l = strlen(cooky);
14651465

14661466
DEBUG_o( Perl_deb(aTHX_ "Checking overloading of \"%s\" in package \"%.256s\"\n",
@@ -1484,7 +1484,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash)
14841484
/* This is a hack to support autoloading..., while
14851485
knowing *which* methods were declared as overloaded. */
14861486
/* GvSV contains the name of the method. */
1487-
GV *ngv = Nullgv;
1487+
GV *ngv = NULL;
14881488
SV *gvsv = GvSV(gv);
14891489

14901490
DEBUG_o( Perl_deb(aTHX_ "Resolving method \"%"SVf256\

hv.c

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
447447

448448
xhv = (XPVHV*)SvANY(hv);
449449
if (SvMAGICAL(hv)) {
450-
if (SvRMAGICAL(hv) && !(action & (HV_FETCH_ISSTORE|HV_FETCH_ISEXISTS)))
451-
{
450+
if (SvRMAGICAL(hv) && !(action & (HV_FETCH_ISSTORE|HV_FETCH_ISEXISTS))) {
452451
if (mg_find((SV*)hv, PERL_MAGIC_tied) || SvGMAGICAL((SV*)hv)) {
453452
sv = sv_newmortal();
454453

@@ -553,7 +552,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
553552
/* Will need to free this, so set FREEKEY flag. */
554553
key = savepvn(key,klen);
555554
key = (const char*)strupr((char*)key);
556-
is_utf8 = 0;
555+
is_utf8 = FALSE;
557556
hash = 0;
558557
keysv = 0;
559558

@@ -596,7 +595,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
596595
/* Will need to free this, so set FREEKEY flag. */
597596
key = savepvn(key,klen);
598597
key = (const char*)strupr((char*)key);
599-
is_utf8 = 0;
598+
is_utf8 = FALSE;
600599
hash = 0;
601600
keysv = 0;
602601

@@ -696,7 +695,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
696695
/* Need to swap the key we have for a key with the flags we
697696
need. As keys are shared we can't just write to the
698697
flag, so we share the new one, unshare the old one. */
699-
HEK *new_hek = share_hek_flags(key, klen, hash,
698+
HEK * const new_hek = share_hek_flags(key, klen, hash,
700699
masked_flags);
701700
unshare_hek (HeKEY_hek(entry));
702701
HeKEY_hek(entry) = new_hek;
@@ -920,13 +919,14 @@ SV *
920919
Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags)
921920
{
922921
STRLEN klen;
923-
int k_flags = 0;
922+
int k_flags;
924923

925924
if (klen_i32 < 0) {
926925
klen = -klen_i32;
927-
k_flags |= HVhek_UTF8;
926+
k_flags = HVhek_UTF8;
928927
} else {
929928
klen = klen_i32;
929+
k_flags = 0;
930930
}
931931
return hv_delete_common(hv, NULL, key, klen, k_flags, flags, 0);
932932
}
@@ -958,7 +958,6 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
958958
register HE *entry;
959959
register HE **oentry;
960960
HE *const *first_entry;
961-
SV *sv;
962961
bool is_utf8;
963962
int masked_flags;
964963

@@ -981,6 +980,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
981980
hv_magic_check (hv, &needs_copy, &needs_store);
982981

983982
if (needs_copy) {
983+
SV *sv;
984984
entry = hv_fetch_common(hv, keysv, key, klen,
985985
k_flags & ~HVhek_FREEKEY, HV_FETCH_LVALUE,
986986
Nullsv, hash);
@@ -1051,6 +1051,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
10511051
first_entry = oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)];
10521052
entry = *oentry;
10531053
for (; entry; oentry = &HeNEXT(entry), entry = *oentry) {
1054+
SV *sv;
10541055
if (HeHASH(entry) != hash) /* strings can't be equal */
10551056
continue;
10561057
if (HeKLEN(entry) != (I32)klen)
@@ -1067,13 +1068,12 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
10671068
}
10681069

10691070
/* if placeholder is here, it's already been deleted.... */
1070-
if (HeVAL(entry) == &PL_sv_placeholder)
1071-
{
1072-
if (k_flags & HVhek_FREEKEY)
1073-
Safefree(key);
1074-
return Nullsv;
1071+
if (HeVAL(entry) == &PL_sv_placeholder) {
1072+
if (k_flags & HVhek_FREEKEY)
1073+
Safefree(key);
1074+
return NULL;
10751075
}
1076-
else if (SvREADONLY(hv) && HeVAL(entry) && SvREADONLY(HeVAL(entry))) {
1076+
if (SvREADONLY(hv) && HeVAL(entry) && SvREADONLY(HeVAL(entry))) {
10771077
S_hv_notallowed(aTHX_ k_flags, key, klen,
10781078
"Attempt to delete readonly key '%"SVf"' from"
10791079
" a restricted hash");
@@ -1368,8 +1368,9 @@ Perl_hv_ksplit(pTHX_ HV *hv, IV newmax)
13681368
if (!*aep) /* non-existent */
13691369
continue;
13701370
for (oentry = aep, entry = *aep; entry; entry = *oentry) {
1371-
register I32 j;
1372-
if ((j = (HeHASH(entry) & newsize)) != i) {
1371+
register I32 j = (HeHASH(entry) & newsize);
1372+
1373+
if (j != i) {
13731374
j -= i;
13741375
*oentry = HeNEXT(entry);
13751376
if (!(HeNEXT(entry) = aep[j]))
@@ -1433,7 +1434,7 @@ Perl_newHVhv(pTHX_ HV *ohv)
14331434

14341435
/* In each bucket... */
14351436
for (i = 0; i <= hv_max; i++) {
1436-
HE *prev = NULL, *ent = NULL;
1437+
HE *prev = NULL;
14371438
HE *oent = oents[i];
14381439

14391440
if (!oent) {
@@ -1447,8 +1448,8 @@ Perl_newHVhv(pTHX_ HV *ohv)
14471448
const char * const key = HeKEY(oent);
14481449
const STRLEN len = HeKLEN(oent);
14491450
const int flags = HeKFLAGS(oent);
1451+
HE * const ent = new_HE();
14501452

1451-
ent = new_HE();
14521453
HeVAL(ent) = newSVsv(HeVAL(oent));
14531454
HeKEY_hek(ent)
14541455
= shared ? share_hek_flags(key, len, hash, flags)
@@ -1557,7 +1558,7 @@ Perl_hv_clear(pTHX_ HV *hv)
15571558
/* not already placeholder */
15581559
if (HeVAL(entry) != &PL_sv_placeholder) {
15591560
if (HeVAL(entry) && SvREADONLY(HeVAL(entry))) {
1560-
SV* keysv = hv_iterkeysv(entry);
1561+
SV* const keysv = hv_iterkeysv(entry);
15611562
Perl_croak(aTHX_
15621563
"Attempt to delete readonly key '%"SVf"' from a restricted hash",
15631564
keysv);
@@ -1615,7 +1616,7 @@ Perl_hv_clear_placeholders(pTHX_ HV *hv)
16151616
i = HvMAX(hv);
16161617
do {
16171618
/* Loop down the linked list heads */
1618-
bool first = 1;
1619+
bool first = TRUE;
16191620
HE **oentry = &(HvARRAY(hv))[i];
16201621
HE *entry;
16211622

@@ -1639,7 +1640,7 @@ Perl_hv_clear_placeholders(pTHX_ HV *hv)
16391640
}
16401641
} else {
16411642
oentry = &HeNEXT(entry);
1642-
first = 0;
1643+
first = FALSE;
16431644
}
16441645
}
16451646
} while (--i >= 0);
@@ -1680,7 +1681,7 @@ S_hfreeentries(pTHX_ HV *hv)
16801681
/* This is the one we're going to try to empty. First time round
16811682
it's the original array. (Hopefully there will only be 1 time
16821683
round) */
1683-
HE **array = HvARRAY(hv);
1684+
HE ** const array = HvARRAY(hv);
16841685
I32 i = HvMAX(hv);
16851686

16861687
/* Because we have taken xhv_name out, the only allocated pointer
@@ -1770,7 +1771,7 @@ S_hfreeentries(pTHX_ HV *hv)
17701771
if (--attempts == 0) {
17711772
Perl_die(aTHX_ "panic: hfreeentries failed to free hash - something is repeatedly re-creating entries");
17721773
}
1773-
};
1774+
}
17741775

17751776
HvARRAY(hv) = orig_array;
17761777

@@ -1866,7 +1867,7 @@ Perl_hv_iterinit(pTHX_ HV *hv)
18661867
Perl_croak(aTHX_ "Bad hash");
18671868

18681869
if (SvOOK(hv)) {
1869-
struct xpvhv_aux *iter = HvAUX(hv);
1870+
struct xpvhv_aux * const iter = HvAUX(hv);
18701871
HE * const entry = iter->xhv_eiter; /* HvEITER(hv) */
18711872
if (entry && HvLAZYDEL(hv)) { /* was deleted earlier? */
18721873
HvLAZYDEL_off(hv);
@@ -1875,7 +1876,7 @@ Perl_hv_iterinit(pTHX_ HV *hv)
18751876
iter->xhv_riter = -1; /* HvRITER(hv) = -1 */
18761877
iter->xhv_eiter = Null(HE*); /* HvEITER(hv) = Null(HE*) */
18771878
} else {
1878-
S_hv_auxinit(aTHX_ hv);
1879+
hv_auxinit(hv);
18791880
}
18801881

18811882
/* used to be xhv->xhv_fill before 5.004_65 */
@@ -1889,7 +1890,7 @@ Perl_hv_riter_p(pTHX_ HV *hv) {
18891890
if (!hv)
18901891
Perl_croak(aTHX_ "Bad hash");
18911892

1892-
iter = SvOOK(hv) ? HvAUX(hv) : S_hv_auxinit(aTHX_ hv);
1893+
iter = SvOOK(hv) ? HvAUX(hv) : hv_auxinit(hv);
18931894
return &(iter->xhv_riter);
18941895
}
18951896

@@ -1900,7 +1901,7 @@ Perl_hv_eiter_p(pTHX_ HV *hv) {
19001901
if (!hv)
19011902
Perl_croak(aTHX_ "Bad hash");
19021903

1903-
iter = SvOOK(hv) ? HvAUX(hv) : S_hv_auxinit(aTHX_ hv);
1904+
iter = SvOOK(hv) ? HvAUX(hv) : hv_auxinit(hv);
19041905
return &(iter->xhv_eiter);
19051906
}
19061907

@@ -1917,7 +1918,7 @@ Perl_hv_riter_set(pTHX_ HV *hv, I32 riter) {
19171918
if (riter == -1)
19181919
return;
19191920

1920-
iter = S_hv_auxinit(aTHX_ hv);
1921+
iter = hv_auxinit(hv);
19211922
}
19221923
iter->xhv_riter = riter;
19231924
}
@@ -1937,7 +1938,7 @@ Perl_hv_eiter_set(pTHX_ HV *hv, HE *eiter) {
19371938
if (!eiter)
19381939
return;
19391940

1940-
iter = S_hv_auxinit(aTHX_ hv);
1941+
iter = hv_auxinit(hv);
19411942
}
19421943
iter->xhv_eiter = eiter;
19431944
}
@@ -1960,17 +1961,15 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, I32 len, int flags)
19601961
if (name == 0)
19611962
return;
19621963

1963-
iter = S_hv_auxinit(aTHX_ hv);
1964+
iter = hv_auxinit(hv);
19641965
}
19651966
PERL_HASH(hash, name, len);
19661967
iter->xhv_name = name ? share_hek(name, len, hash) : 0;
19671968
}
19681969

19691970
AV **
19701971
Perl_hv_backreferences_p(pTHX_ HV *hv) {
1971-
struct xpvhv_aux *iter;
1972-
1973-
iter = SvOOK(hv) ? HvAUX(hv) : S_hv_auxinit(aTHX_ hv);
1972+
struct xpvhv_aux * const iter = SvOOK(hv) ? HvAUX(hv) : hv_auxinit(hv);
19741973
return &(iter->xhv_backreferences);
19751974
}
19761975

0 commit comments

Comments
 (0)