Front page | perl.perl5.porters |
Postings from May 2001
Re: [PATCH pp_sys.c] More warnings
Thread Previous
|
Thread Next
From:
Nick Ing-Simmons
Date:
May 30, 2001 07:32
Subject:
Re: [PATCH pp_sys.c] More warnings
Message ID:
20010530143239.567.18@dromedary.ni-s.u-net.com
Michael G Schwern <schwern@pobox.com> writes:
>On Wed, May 30, 2001 at 12:27:03PM +0100, Hugo wrote:
>> While I don't believe in lint-proofing every call that ignores its
>> return value, I do think it makes sense to clarify that we are
>> deliberately ignoring a return value when calling functions that
>> in other cases we nearly always _do_ use the return value, with:
>> (void)SvPV(TOPs, n_a);
>>
>> This counts for the doop.c patch as well.
>>
>> Also, where we are ignoring the length as well we should be using the
>> (relatively recent) new macro that specifies that, so the above
>> probably wants to be:
>> (void)SvPV_nolen(TOPs); /* stringify for taint check */
>
>I'll keep that in mind.
>
>Ya know, damnit. I just went through all the trouble of removing all
>the apparently useless n_a variables only to find out its a magic
>macro variable. :( Is it safe to change instances of "SvPV(Foo, n_a)"
>to "SvPV_nolen(Foo)"?
Maybe - we are not sure or we would have done it a long time ago with a perl one-liner.
Most are okay, but there are probably lingering spots where n_a is used
as a scratch variable and value _is_ used.
The magical n_a is a pain in the threaded case - better to have a local
variable than have to lookup thread-private storage just for something
we are (probably) going to ignore.
I guess we could run the one-liner and then see what broke...
>
>PS What's the difference between SvPV and SvPVx?
Read the source (i.e. sv.h) ...
SvPVx makes a copy of the SV * so that
SvPVx(*p++,len) is "okay"
whereas
SvPV(*p++,len) isn't as the macro may do multiple ++s.
>
>
>This is the minimal patch to shut up the warnings. Someone more
>knowledgable might want to do a full clean up.
>
>--- pp_sys.c 2001/05/30 10:36:24 1.1
>+++ pp_sys.c 2001/05/30 13:57:09
>@@ -3970,7 +3970,7 @@
>
> if (SP - MARK == 1) {
> if (PL_tainting) {
>- char *junk = SvPV(TOPs, n_a);
>+ (void)SvPV(TOPs, n_a);
> TAINT_ENV();
> TAINT_PROPER("system");
> }
>@@ -4096,7 +4096,7 @@
> #endif
> else {
> if (PL_tainting) {
>- char *junk = SvPV(*SP, n_a);
>+ (void)SvPV(*SP, n_a);
> TAINT_ENV();
> TAINT_PROPER("exec");
> }
--
Nick Ing-Simmons
who is looking for a new job see http://www.ni-s.u-net.com/
Thread Previous
|
Thread Next