develooper Front page | perl.perl5.porters | Postings from September 2003

[PATCH] silence 1 compiler warning

From:
Nicholas Clark
Date:
September 8, 2003 15:05
Subject:
[PATCH] silence 1 compiler warning
Message ID:
20030908230445.E30881@plum.flirble.org
I spotted one warning fly past:

          CCCMD =  ccache gcc -DPERL_CORE -c -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2  -Wall
universal.c: In function `XS_Internals_hashes_random':
universal.c:723: warning: unused variable `items'

The appended patch will silence it (taking out dITEM will then make sp
unused, so in turn dSP can go)

Is there any security reason to to return the actual value of the hash seed?

It would give the same true/false semantics, but would also let perl level
code access it. I've found with testing using (pseudo)random data that it's
often useful to be able to print out the seed used if tests fail, so that
you can repeat the failing scenario. Being able to get at the hash seed
would let people re-test specific hash-ordering failures that they chance
upon.

Nicholas Clark

--- universal.c.orig	2003-09-08 21:44:32.000000000 +0100
+++ universal.c	2003-09-08 22:52:00.000000000 +0100
@@ -720,7 +720,11 @@ XS(XS_PerlIO_get_layers)
 
 XS(XS_Internals_hashes_random)
 {
-    dXSARGS;
+    /* Using dXSARGS would also have dITEM and dSP, which define 2 unused
+       local variables  */
+    dMARK;
+    dAX;
+
     XSRETURN_IV(PL_hash_seed ? 1 : 0);
 }
 



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