develooper Front page | perl.perl5.porters | Postings from May 2001

Re: [PATCH pp_sys.c] More warnings

Thread Previous | Thread Next
From:
Hugo
Date:
May 30, 2001 05:24
Subject:
Re: [PATCH pp_sys.c] More warnings
Message ID:
200105301127.MAA03441@crypt.compulink.co.uk
In <20010530113849.W670@blackrider.blackstar.co.uk>, Michael G Schwern writes:
:Another little warnings patch.  This one eliminates the unused junk
:variable.  The SvPV macro seems to work just fine stand-alone.
:
:--- pp_sys.c	2001/05/30 10:36:24	1.1
:+++ pp_sys.c	2001/05/30 10:36:44
:@@ -3970,7 +3970,7 @@
: 
:     if (SP - MARK == 1) {
: 	if (PL_tainting) {
:-	    char *junk = SvPV(TOPs, n_a);
:+	    SvPV(TOPs, n_a);
: 	    TAINT_ENV();
: 	    TAINT_PROPER("system");
: 	}
[...]

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 */

Hugo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About