From: Jarkko Hietaniemi Date: Wed, 29 Aug 2007 21:04:53 +0000 (-0400) Subject: misc blead stuff X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe5bfecd71ca735f83568f7bc2b9f22cc82e3d61;p=p5sagit%2Fp5-mst-13.2.git misc blead stuff Message-ID: <46D617B5.3000002@iki.fi> p4raw-id: //depot/perl@31765 --- diff --git a/deb.c b/deb.c index 37d7a7c..a3f0d4f 100644 --- a/deb.c +++ b/deb.c @@ -41,15 +41,14 @@ Perl_deb_nocontext(const char *pat, ...) void Perl_deb(pTHX_ const char *pat, ...) { -#ifdef DEBUGGING va_list args; va_start(args, pat); +#ifdef DEBUGGING vdeb(pat, &args); - va_end(args); #else PERL_UNUSED_CONTEXT; - PERL_UNUSED_ARG(pat); #endif /* DEBUGGING */ + va_end(args); } void diff --git a/mg.c b/mg.c index 14b237e..89f4c32 100644 --- a/mg.c +++ b/mg.c @@ -1317,6 +1317,9 @@ Perl_csighandler(int sig) #else dTHX; #endif +#if defined(HAS_SIGACTION) && defined(SA_SIGINFO) + va_list args; +#endif #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS (void) rsignal(sig, PL_csighandlerp); if (PL_sig_ignoring[sig]) return; @@ -1329,6 +1332,9 @@ Perl_csighandler(int sig) exit(1); #endif #endif +#if defined(HAS_SIGACTION) && defined(SA_SIGINFO) + va_start(args, sig); +#endif if ( #ifdef SIGILL sig == SIGILL || @@ -1345,6 +1351,9 @@ Perl_csighandler(int sig) (*PL_sighandlerp)(sig); else S_raise_signal(aTHX_ sig); +#if defined(HAS_SIGACTION) && defined(SA_SIGINFO) + va_end(args); +#endif } #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS) diff --git a/op.c b/op.c index ada5a3d..015f26f 100644 --- a/op.c +++ b/op.c @@ -3971,7 +3971,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) PL_modcount = 0; /* Grandfathering $[ assignment here. Bletch.*/ /* Only simple assignments like C<< ($[) = 1 >> are allowed */ - PL_eval_start = (left->op_type == OP_CONST) ? right : 0; + PL_eval_start = (left->op_type == OP_CONST) ? right : NULL; left = mod(left, OP_AASSIGN); if (PL_eval_start) PL_eval_start = 0; diff --git a/pod/perlapi.pod b/pod/perlapi.pod index 702cd50..c8ac827 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -5167,11 +5167,11 @@ X Creates a new SV with its SvPVX_const pointing to a shared string in the string table. If the string does not already exist in the table, it is created -first. Turns on READONLY and FAKE. The string's hash is stored in the UV -slot of the SV; if the C parameter is non-zero, that value is used; -otherwise the hash is computed. The idea here is that as the string table -is used for shared hash keys these strings will have SvPVX_const == HeKEY and -hash lookup will avoid string compare. +first. Turns on READONLY and FAKE. If the C parameter is non-zero, that +value is used; otherwise the hash is computed. The string's hash can be later +be retrieved from the SV with the C macro. The idea here is +that as the string table is used for shared hash keys these strings will have +SvPVX_const == HeKEY and hash lookup will avoid string compare. SV* newSVpvn_share(const char* s, I32 len, U32 hash) diff --git a/pp.c b/pp.c index 54df53e..5171e57 100644 --- a/pp.c +++ b/pp.c @@ -4066,7 +4066,7 @@ PP(pp_hslice) } he = hv_fetch_ent(hv, keysv, lval, 0); - svp = he ? &HeVAL(he) : 0; + svp = he ? &HeVAL(he) : NULL; if (lval) { if (!svp || *svp == &PL_sv_undef) { diff --git a/pp_sys.c b/pp_sys.c index 71f8d8b..b79031c 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -476,7 +476,7 @@ PP(pp_die) } else { tmpsv = TOPs; - tmps = SvROK(tmpsv) ? NULL : SvPV_const(tmpsv, len); + tmps = SvROK(tmpsv) ? (const char *)NULL : SvPV_const(tmpsv, len); } if (!tmps || !len) { SV * const error = ERRSV; diff --git a/reentr.c b/reentr.c index 9447fc3..ffe7eb0 100644 --- a/reentr.c +++ b/reentr.c @@ -313,6 +313,8 @@ Perl_reentrant_retry(const char *f, ...) { dTHX; void *retptr = NULL; + va_list ap; + va_start(ap, f); #ifdef USE_REENTRANT_API # if defined(USE_HOSTENT_BUFFER) || defined(USE_GRENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PWENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER) void *p0; @@ -326,9 +328,6 @@ Perl_reentrant_retry(const char *f, ...) # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER) int anint; # endif - va_list ap; - - va_start(ap, f); switch (PL_op->op_type) { #ifdef USE_HOSTENT_BUFFER @@ -531,11 +530,10 @@ Perl_reentrant_retry(const char *f, ...) /* Not known how to retry, so just fail. */ break; } - - va_end(ap); #else PERL_UNUSED_ARG(f); #endif + va_end(ap); return retptr; } diff --git a/reentr.pl b/reentr.pl index 049b06e..84676d4 100644 --- a/reentr.pl +++ b/reentr.pl @@ -856,6 +856,8 @@ Perl_reentrant_retry(const char *f, ...) { dTHX; void *retptr = NULL; + va_list ap; + va_start(ap, f); #ifdef USE_REENTRANT_API # if defined(USE_HOSTENT_BUFFER) || defined(USE_GRENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PWENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER) void *p0; @@ -869,9 +871,6 @@ Perl_reentrant_retry(const char *f, ...) # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER) int anint; # endif - va_list ap; - - va_start(ap, f); switch (PL_op->op_type) { #ifdef USE_HOSTENT_BUFFER @@ -1074,11 +1073,10 @@ Perl_reentrant_retry(const char *f, ...) /* Not known how to retry, so just fail. */ break; } - - va_end(ap); #else PERL_UNUSED_ARG(f); #endif + va_end(ap); return retptr; } diff --git a/regexec.c b/regexec.c index 1cd3857..3e42f58 100644 --- a/regexec.c +++ b/regexec.c @@ -5572,8 +5572,8 @@ Perl_regclass_swash(pTHX_ const regexp *prog, register const regnode* node, bool * documentation of these array elements. */ si = *ary; - a = SvROK(ary[1]) ? &ary[1] : 0; - b = SvTYPE(ary[2]) == SVt_PVAV ? &ary[2] : 0; + a = SvROK(ary[1]) ? &ary[1] : NULL; + b = SvTYPE(ary[2]) == SVt_PVAV ? &ary[2] : NULL; if (a) sw = *a; diff --git a/sv.c b/sv.c index bf9e575..e431cff 100644 --- a/sv.c +++ b/sv.c @@ -5397,7 +5397,7 @@ Perl_sv_len_utf8(pTHX_ register SV *sv) if (PL_utf8cache) { STRLEN ulen; - MAGIC *mg = SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : 0; + MAGIC *mg = SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL; if (mg && mg->mg_len != -1) { ulen = mg->mg_len;