Change 29794 by [EMAIL PROTECTED] on 2007/01/13 19:26:17
Integrate:
[ 26532]
Subject: [PATCH] Perl_gv_fetchpv vs. gv_fetchpvn
From: Tels <[EMAIL PROTECTED]>
Date: Thu, 29 Dec 2005 18:32:10 +0100
Message-Id: <[EMAIL PROTECTED]>
[ 26533]
Subject: [PATCH] perlio.c - gv_stashpvn() vs gv_stashpv()
From: Tels <[EMAIL PROTECTED]>
Date: Thu, 29 Dec 2005 18:57:43 +0100
Message-Id: <[EMAIL PROTECTED]>
[ 26556]
Subject: [PATCH] Making 0 pointers to NULLs
From: Andy Lester <[EMAIL PROTECTED]>
Date: Fri, 30 Dec 2005 23:05:58 -0600
Message-ID: <[EMAIL PROTECTED]>
[ 26558]
Subject: [PATCH] Making 0 pointers to NULLs
From: Andy Lester <[EMAIL PROTECTED]>
Date: Fri, 30 Dec 2005 23:05:58 -0600
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/maint-5.8/perl/doio.c#82 integrate
... //depot/maint-5.8/perl/doop.c#42 integrate
... //depot/maint-5.8/perl/gv.c#76 integrate
... //depot/maint-5.8/perl/hv.c#87 integrate
... //depot/maint-5.8/perl/mg.c#117 integrate
... //depot/maint-5.8/perl/perlio.c#80 integrate
... //depot/maint-5.8/perl/pp.c#106 integrate
... //depot/maint-5.8/perl/pp_ctl.c#133 integrate
... //depot/maint-5.8/perl/pp_hot.c#108 integrate
... //depot/maint-5.8/perl/pp_sort.c#38 integrate
... //depot/maint-5.8/perl/regcomp.c#74 integrate
... //depot/maint-5.8/perl/regexec.c#62 integrate
... //depot/maint-5.8/perl/sv.c#275 integrate
... //depot/maint-5.8/perl/toke.c#124 integrate
... //depot/maint-5.8/perl/utf8.c#60 integrate
... //depot/maint-5.8/perl/util.c#113 integrate
Differences ...
==== //depot/maint-5.8/perl/doio.c#82 (text) ====
Index: perl/doio.c
--- perl/doio.c#81~29775~ 2007-01-12 06:07:47.000000000 -0800
+++ perl/doio.c 2007-01-13 11:26:17.000000000 -0800
@@ -1053,7 +1053,7 @@
Off_t
Perl_do_tell(pTHX_ GV *gv)
{
- register IO *io = 0;
+ register IO *io = NULL;
register PerlIO *fp;
if (gv && (io = GvIO(gv)) && (fp = IoIFP(io))) {
@@ -1072,7 +1072,7 @@
bool
Perl_do_seek(pTHX_ GV *gv, Off_t pos, int whence)
{
- register IO *io = 0;
+ register IO *io = NULL;
register PerlIO *fp;
if (gv && (io = GvIO(gv)) && (fp = IoIFP(io))) {
@@ -1091,7 +1091,7 @@
Off_t
Perl_do_sysseek(pTHX_ GV *gv, Off_t pos, int whence)
{
- register IO *io = 0;
+ register IO *io = NULL;
register PerlIO *fp;
if (gv && (io = GvIO(gv)) && (fp = IoIFP(io)))
==== //depot/maint-5.8/perl/doop.c#42 (text) ====
Index: perl/doop.c
--- perl/doop.c#41~29791~ 2007-01-13 10:27:36.000000000 -0800
+++ perl/doop.c 2007-01-13 11:26:17.000000000 -0800
@@ -399,7 +399,8 @@
S_do_trans_count_utf8(pTHX_ SV *sv)
{
const U8 *s;
- const U8 *start = 0, *send;
+ const U8 *start = NULL;
+ const U8 *send;
I32 matches = 0;
STRLEN len;
==== //depot/maint-5.8/perl/gv.c#76 (text) ====
Index: perl/gv.c
--- perl/gv.c#75~29792~ 2007-01-13 10:44:35.000000000 -0800
+++ perl/gv.c 2007-01-13 11:26:17.000000000 -0800
@@ -706,7 +706,7 @@
tmpbuf[namelen++] = ':';
tmpbuf[namelen++] = ':';
tmpbuf[namelen] = '\0';
- tmpgv = gv_fetchpv(tmpbuf, create, SVt_PVHV);
+ tmpgv = gv_fetchpvn_flags(tmpbuf, namelen, create, SVt_PVHV);
if (tmpbuf != smallbuf)
Safefree(tmpbuf);
if (!tmpgv)
@@ -1267,10 +1267,10 @@
SvOBJECT_on(io);
/* Clear the stashcache because a new IO could overrule a package name */
hv_clear(PL_stashcache);
- iogv = gv_fetchpv("FileHandle::", 0, SVt_PVHV);
+ iogv = gv_fetchpvn_flags("FileHandle::", 12, 0, SVt_PVHV);
/* unless exists($main::{FileHandle}) and defined(%main::FileHandle::) */
if (!(iogv && GvHV(iogv) && HvARRAY(GvHV(iogv))))
- iogv = gv_fetchpv("IO::Handle::", TRUE, SVt_PVHV);
+ iogv = gv_fetchpvn_flags("IO::Handle::", 12, TRUE, SVt_PVHV);
SvSTASH_set(io, (HV*)SvREFCNT_inc(GvHV(iogv)));
return io;
}
==== //depot/maint-5.8/perl/mg.c#117 (text) ====
Index: perl/mg.c
--- perl/mg.c#116~29791~ 2007-01-13 10:27:36.000000000 -0800
+++ perl/mg.c 2007-01-13 11:26:17.000000000 -0800
@@ -1230,7 +1230,7 @@
register const char * const s = MgPV_nolen_const(mg);
PERL_UNUSED_ARG(sv);
if (*s == '_') {
- SV** svp = 0;
+ SV** svp = NULL;
if (strEQ(s,"__DIE__"))
svp = &PL_diehook;
else if (strEQ(s,"__WARN__"))
@@ -1239,7 +1239,7 @@
Perl_croak(aTHX_ "No such hook: %s", s);
if (svp && *svp) {
SV * const to_dec = *svp;
- *svp = 0;
+ *svp = NULL;
SvREFCNT_dec(to_dec);
}
}
@@ -1374,12 +1374,12 @@
Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
{
I32 i;
- SV** svp = 0;
+ SV** svp = NULL;
/* Need to be careful with SvREFCNT_dec(), because that can have side
* effects (due to closures). We must make sure that the new disposition
* is in place before it is called.
*/
- SV* to_dec = 0;
+ SV* to_dec = NULL;
STRLEN len;
#ifdef HAS_SIGPROCMASK
sigset_t set, save;
@@ -1397,7 +1397,7 @@
i = 0;
if (*svp) {
to_dec = *svp;
- *svp = 0;
+ *svp = NULL;
}
}
else {
==== //depot/maint-5.8/perl/perlio.c#80 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#79~29775~ 2007-01-12 06:07:47.000000000 -0800
+++ perl/perlio.c 2007-01-13 11:26:17.000000000 -0800
@@ -870,7 +870,7 @@
SV *
PerlIO_tab_sv(pTHX_ PerlIO_funcs *tab)
{
- HV * const stash = gv_stashpv("PerlIO::Layer", TRUE);
+ HV * const stash = gv_stashpvn("PerlIO::Layer", 13, TRUE);
SV * const sv = sv_bless(newRV_noinc(newSViv(PTR2IV(tab))), stash);
return sv;
}
==== //depot/maint-5.8/perl/pp.c#106 (text) ====
Index: perl/pp.c
--- perl/pp.c#105~29791~ 2007-01-13 10:27:36.000000000 -0800
+++ perl/pp.c 2007-01-13 11:26:17.000000000 -0800
@@ -2915,7 +2915,7 @@
const char *tmps;
const I32 arybase = PL_curcop->cop_arybase;
SV *repl_sv = NULL;
- const char *repl = 0;
+ const char *repl = NULL;
STRLEN repl_len;
const int num_args = PL_op->op_private & 7;
bool repl_need_utf8_upgrade = FALSE;
@@ -4082,7 +4082,7 @@
I32 newlen;
I32 after;
I32 diff;
- SV **tmparyval = 0;
+ SV **tmparyval = NULL;
const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied);
if (mg) {
==== //depot/maint-5.8/perl/pp_ctl.c#133 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#132~29789~ 2007-01-13 10:10:34.000000000 -0800
+++ perl/pp_ctl.c 2007-01-13 11:26:17.000000000 -0800
@@ -353,7 +353,7 @@
bool item_is_utf8 = FALSE;
bool targ_is_utf8 = FALSE;
SV * nsv = NULL;
- OP * parseres = 0;
+ OP * parseres = NULL;
const char *fmt;
bool oneline;
@@ -2127,12 +2127,12 @@
PP(pp_goto)
{
dSP;
- OP *retop = 0;
+ OP *retop = NULL;
I32 ix;
register PERL_CONTEXT *cx;
#define GOTO_DEPTH 64
OP *enterops[GOTO_DEPTH];
- const char *label = 0;
+ const char *label = NULL;
const bool do_dump = (PL_op->op_type == OP_DUMP);
static const char must_have_label[] = "goto must have label";
@@ -2389,10 +2389,10 @@
label = cPVOP->op_pv;
if (label && *label) {
- OP *gotoprobe = 0;
+ OP *gotoprobe = NULL;
bool leaving_eval = FALSE;
bool in_block = FALSE;
- PERL_CONTEXT *last_eval_cx = 0;
+ PERL_CONTEXT *last_eval_cx = NULL;
/* find label */
@@ -3657,7 +3657,7 @@
bool postspace = FALSE;
U32 *fops;
register U32 *fpc;
- U32 *linepc = 0;
+ U32 *linepc = NULL;
register I32 arg;
bool ischop;
bool unchopnum = FALSE;
==== //depot/maint-5.8/perl/pp_hot.c#108 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#107~29787~ 2007-01-13 09:24:48.000000000 -0800
+++ perl/pp_hot.c 2007-01-13 11:26:17.000000000 -0800
@@ -1044,7 +1044,7 @@
I32 i;
int magic;
int duplicates = 0;
- SV **firsthashrelem = 0; /* "= 0" keeps gcc 2.95 quiet */
+ SV **firsthashrelem = NULL; /* "= 0" keeps gcc 2.95 quiet */
PL_delaymagic = DM_DELAY; /* catch simultaneous items */
@@ -1443,9 +1443,11 @@
}
else {
if (global) {
- MAGIC* mg = 0;
+ MAGIC* mg;
if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG))
mg = mg_find(TARG, PERL_MAGIC_regex_global);
+ else
+ mg = NULL;
if (!mg) {
sv_magic(TARG, (SV*)0, PERL_MAGIC_regex_global, Nullch, 0);
mg = mg_find(TARG, PERL_MAGIC_regex_global);
==== //depot/maint-5.8/perl/pp_sort.c#38 (text) ====
Index: perl/pp_sort.c
--- perl/pp_sort.c#37~29772~ 2007-01-12 05:28:49.000000000 -0800
+++ perl/pp_sort.c 2007-01-13 11:26:17.000000000 -0800
@@ -1479,7 +1479,7 @@
AV* av = NULL;
HV *stash;
GV *gv;
- CV *cv = 0;
+ CV *cv = NULL;
I32 gimme = GIMME;
OP* const nextop = PL_op->op_next;
I32 overloading = 0;
==== //depot/maint-5.8/perl/regcomp.c#74 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#73~29787~ 2007-01-13 09:24:48.000000000 -0800
+++ perl/regcomp.c 2007-01-13 11:26:17.000000000 -0800
@@ -2145,18 +2145,21 @@
register regnode *ret; /* Will be the head of the group. */
register regnode *br;
register regnode *lastbr;
- register regnode *ender = 0;
+ register regnode *ender = NULL;
register I32 parno = 0;
- I32 flags, oregflags = RExC_flags, have_branch = 0, open = 0;
+ I32 flags;
+ const I32 oregflags = RExC_flags;
+ I32 have_branch = 0;
+ I32 open = 0;
/* for (?g), (?gc), and (?o) warnings; warning
about (?c) will warn about (?g) -- japhy */
- I32 wastedflags = 0x00,
- wasted_o = 0x01,
- wasted_g = 0x02,
- wasted_gc = 0x02 | 0x04,
- wasted_c = 0x04;
+ I32 wastedflags = 0x00;
+ const I32 wasted_o = 0x01;
+ const I32 wasted_g = 0x02;
+ const I32 wasted_gc = 0x02 | 0x04;
+ const I32 wasted_c = 0x04;
char * parse_start = RExC_parse; /* MJD */
char * const oregcomp_parse = RExC_parse;
@@ -2796,7 +2799,7 @@
STATIC regnode *
S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp)
{
- register regnode *ret = 0;
+ register regnode *ret = NULL;
I32 flags;
char *parse_start = RExC_parse;
@@ -3577,13 +3580,13 @@
register regnode *ret;
STRLEN numlen;
IV namedclass;
- char *rangebegin = 0;
+ char *rangebegin = NULL;
bool need_class = 0;
SV *listsv = NULL;
register char *e;
UV n;
bool optimize_invert = TRUE;
- AV* unicode_alternate = 0;
+ AV* unicode_alternate = NULL;
#ifdef EBCDIC
UV literal_endpoint = 0;
#endif
==== //depot/maint-5.8/perl/regexec.c#62 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#61~29770~ 2007-01-12 04:22:53.000000000 -0800
+++ perl/regexec.c 2007-01-13 11:26:17.000000000 -0800
@@ -877,7 +877,7 @@
s = find_byclass(prog, prog->regstclass, s, endpos, 1);
if (!s) {
#ifdef DEBUGGING
- const char *what = 0;
+ const char *what = NULL;
#endif
if (endpos == strend) {
DEBUG_r( PerlIO_printf(Perl_debug_log,
==== //depot/maint-5.8/perl/sv.c#275 (text) ====
Index: perl/sv.c
--- perl/sv.c#274~29793~ 2007-01-13 10:59:04.000000000 -0800
+++ perl/sv.c 2007-01-13 11:26:17.000000000 -0800
@@ -3073,7 +3073,7 @@
if (dtype >= SVt_PV) {
if (dtype == SVt_PVGV) {
SV * const sref = SvREFCNT_inc(SvRV(sstr));
- SV *dref = 0;
+ SV *dref = NULL;
const int intro = GvINTRO(dstr);
#ifdef GV_UNIQUE_CHECK
@@ -5736,7 +5736,7 @@
{
/*The big, slow, and stupid way. */
#ifdef USE_HEAP_INSTEAD_OF_STACK /* Even slower way. */
- STDCHAR *buf = 0;
+ STDCHAR *buf = NULL;
Newx(buf, 8192, STDCHAR);
assert(buf);
#else
==== //depot/maint-5.8/perl/toke.c#124 (text) ====
Index: perl/toke.c
--- perl/toke.c#123~29792~ 2007-01-13 10:44:35.000000000 -0800
+++ perl/toke.c 2007-01-13 11:26:17.000000000 -0800
@@ -4052,8 +4052,8 @@
keylookup: {
I32 tmp;
I32 orig_keyword = 0;
- GV *gv = Nullgv;
- GV **gvp = 0;
+ GV *gv = NULL;
+ GV **gvp = NULL;
PL_bufptr = s;
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len);
@@ -4095,8 +4095,8 @@
}
if (tmp < 0) { /* second-class keyword? */
- GV *ogv = Nullgv; /* override (winner) */
- GV *hgv = Nullgv; /* hidden (loser) */
+ GV *ogv = NULL; /* override (winner) */
+ GV *hgv = NULL; /* hidden (loser) */
if (PL_expect != XOPERATOR && (*s != ':' || s[1] != ':')) {
CV *cv;
if ((gv = gv_fetchpv(PL_tokenbuf, 0, SVt_PVCV)) &&
@@ -10226,7 +10226,7 @@
NV nv; /* number read, as a double */
SV *sv = NULL; /* place to put the converted number */
bool floatit; /* boolean: int or float? */
- const char *lastub = 0; /* position of last underbar */
+ const char *lastub = NULL; /* position of last underbar */
static char const number_too_long[] = "Number too long";
/* We use the first character to decide what type of number this is */
==== //depot/maint-5.8/perl/utf8.c#60 (text) ====
Index: perl/utf8.c
--- perl/utf8.c#59~29771~ 2007-01-12 05:01:39.000000000 -0800
+++ perl/utf8.c 2007-01-13 11:26:17.000000000 -0800
@@ -2204,9 +2204,12 @@
{
register const U8 *p1 = (const U8*)s1;
register const U8 *p2 = (const U8*)s2;
- register const U8 *f1 = 0, *f2 = 0;
- register U8 *e1 = 0, *q1 = 0;
- register U8 *e2 = 0, *q2 = 0;
+ register const U8 *f1 = NULL;
+ register U8 *f2 = NULL;
+ register U8 *e1 = NULL;
+ register U8 *q1 = NULL;
+ register U8 *e2 = NULL;
+ register U8 *q2 = NULL;
STRLEN n1 = 0, n2 = 0;
U8 foldbuf1[UTF8_MAXBYTES_CASE+1];
U8 foldbuf2[UTF8_MAXBYTES_CASE+1];
==== //depot/maint-5.8/perl/util.c#113 (text) ====
Index: perl/util.c
--- perl/util.c#112~29791~ 2007-01-13 10:27:36.000000000 -0800
+++ perl/util.c 2007-01-13 11:26:17.000000000 -0800
@@ -135,7 +135,6 @@
where = (Malloc_t)((char*)where-sTHX);
size += sTHX;
if (*(tTHX*)where != aTHX) {
- /* int *nowhere = NULL; *nowhere = 0; */
Perl_croak_nocontext("panic: realloc from wrong pool");
}
#endif
@@ -176,7 +175,6 @@
#ifdef PERL_TRACK_MEMPOOL
where = (Malloc_t)((char*)where-sTHX);
if (*(tTHX*)where != aTHX) {
- /* int *nowhere = NULL; *nowhere = 0; */
Perl_croak_nocontext("panic: free from wrong pool");
}
#endif
End of Patch.