s/new_hash/rehash/g (Stas suggested a better name)
Nicholas Clark [Mon, 3 Nov 2003 06:46:48 +0000 (06:46 +0000)]
p4raw-id: //depot/perl@21638

embedvar.h
hv.h
intrpvar.h
lib/Hash/Util.pm
perl.c
perlapi.h
sv.c
universal.c
util.c

index f58fae9..08631b4 100644 (file)
 #define PL_multi_open          (vTHX->Imulti_open)
 #define PL_multi_start         (vTHX->Imulti_start)
 #define PL_multiline           (vTHX->Imultiline)
-#define PL_new_hash_seed       (vTHX->Inew_hash_seed)
-#define PL_new_hash_seed_set   (vTHX->Inew_hash_seed_set)
 #define PL_nexttoke            (vTHX->Inexttoke)
 #define PL_nexttype            (vTHX->Inexttype)
 #define PL_nextval             (vTHX->Inextval)
 #define PL_reentrant_retint    (vTHX->Ireentrant_retint)
 #define PL_regex_pad           (vTHX->Iregex_pad)
 #define PL_regex_padav         (vTHX->Iregex_padav)
+#define PL_rehash_seed         (vTHX->Irehash_seed)
+#define PL_rehash_seed_set     (vTHX->Irehash_seed_set)
 #define PL_replgv              (vTHX->Ireplgv)
 #define PL_rsfp                        (vTHX->Irsfp)
 #define PL_rsfp_filters                (vTHX->Irsfp_filters)
 #define PL_Imulti_open         PL_multi_open
 #define PL_Imulti_start                PL_multi_start
 #define PL_Imultiline          PL_multiline
-#define PL_Inew_hash_seed      PL_new_hash_seed
-#define PL_Inew_hash_seed_set  PL_new_hash_seed_set
 #define PL_Inexttoke           PL_nexttoke
 #define PL_Inexttype           PL_nexttype
 #define PL_Inextval            PL_nextval
 #define PL_Ireentrant_retint   PL_reentrant_retint
 #define PL_Iregex_pad          PL_regex_pad
 #define PL_Iregex_padav                PL_regex_padav
+#define PL_Irehash_seed                PL_rehash_seed
+#define PL_Irehash_seed_set    PL_rehash_seed_set
 #define PL_Ireplgv             PL_replgv
 #define PL_Irsfp               PL_rsfp
 #define PL_Irsfp_filters       PL_rsfp_filters
diff --git a/hv.h b/hv.h
index ee6d192..0fcda5e 100644 (file)
--- a/hv.h
+++ b/hv.h
@@ -95,7 +95,7 @@ struct xpvhv {
        register const char *s_PeRlHaSh_tmp = str; \
        register const unsigned char *s_PeRlHaSh = (const unsigned char *)s_PeRlHaSh_tmp; \
        register I32 i_PeRlHaSh = len; \
-       register U32 hash_PeRlHaSh = PL_new_hash_seed; \
+       register U32 hash_PeRlHaSh = PL_rehash_seed; \
        while (i_PeRlHaSh--) { \
            hash_PeRlHaSh += *s_PeRlHaSh++; \
            hash_PeRlHaSh += (hash_PeRlHaSh << 10); \
index 7017a70..f8b20a5 100644 (file)
@@ -531,9 +531,9 @@ PERLVAR(IDBassertion,   SV *)
 
 PERLVARI(Icv_has_eval, I32, 0) /* PL_compcv includes an entereval or similar */
 
-PERLVARI(Inew_hash_seed, UV, 0)                /* 582 hash initializer */
+PERLVARI(Irehash_seed, UV, 0)          /* 582 hash initializer */
 
-PERLVARI(Inew_hash_seed_set, bool, FALSE)      /* 582 hash initialized? */
+PERLVARI(Irehash_seed_set, bool, FALSE)        /* 582 hash initialized? */
 
 /* New variables must be added to the very end, before this comment,
  * for binary compatibility (the offsets of the old members must not change).
index 03308c8..3d65ee0 100644 (file)
@@ -196,7 +196,7 @@ See also L<perlrun/PERL_HASH_SEED_DEBUG>.
 =cut
 
 sub hash_seed () {
-    Internals::new_hash_seed();
+    Internals::rehash_seed();
 }
 
 =back
diff --git a/perl.c b/perl.c
index 3860d2d..4157df9 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -942,11 +942,11 @@ setuid perl scripts securely.\n");
 #if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)
     /* [perl #22371] Algorimic Complexity Attack on Perl 5.6.1, 5.8.0
      * This MUST be done before any hash stores or fetches take place.
-     * If you set PL_hash_seed (and assumedly also PL_hash_seed_set) yourself,
-     * it is your responsibility to provide a good random seed!
+     * If you set PL_rehash_seed (and assumedly also PL_rehash_seed_set)
+     * yourself, it is your responsibility to provide a good random seed!
      * You can also define PERL_HASH_SEED in compile time, see hv.h. */
-    if (!PL_new_hash_seed_set)
-        PL_new_hash_seed = get_hash_seed();
+    if (!PL_rehash_seed_set)
+        PL_rehash_seed = get_hash_seed();
     {
         char *s = PerlEnv_getenv("PERL_HASH_SEED_DEBUG");
 
@@ -955,7 +955,7 @@ setuid perl scripts securely.\n");
 
              if (i == 1)
                   PerlIO_printf(Perl_debug_log, "HASH_SEED = %"UVuf"\n",
-                                PL_new_hash_seed);
+                                PL_rehash_seed);
         }
     }
 #endif /* #if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT) */
index ac14cf9..c761540 100644 (file)
--- a/perlapi.h
+++ b/perlapi.h
@@ -398,10 +398,6 @@ END_EXTERN_C
 #define PL_multi_start         (*Perl_Imulti_start_ptr(aTHX))
 #undef  PL_multiline
 #define PL_multiline           (*Perl_Imultiline_ptr(aTHX))
-#undef  PL_new_hash_seed
-#define PL_new_hash_seed       (*Perl_Inew_hash_seed_ptr(aTHX))
-#undef  PL_new_hash_seed_set
-#define PL_new_hash_seed_set   (*Perl_Inew_hash_seed_set_ptr(aTHX))
 #undef  PL_nexttoke
 #define PL_nexttoke            (*Perl_Inexttoke_ptr(aTHX))
 #undef  PL_nexttype
@@ -494,6 +490,10 @@ END_EXTERN_C
 #define PL_regex_pad           (*Perl_Iregex_pad_ptr(aTHX))
 #undef  PL_regex_padav
 #define PL_regex_padav         (*Perl_Iregex_padav_ptr(aTHX))
+#undef  PL_rehash_seed
+#define PL_rehash_seed         (*Perl_Irehash_seed_ptr(aTHX))
+#undef  PL_rehash_seed_set
+#define PL_rehash_seed_set     (*Perl_Irehash_seed_set_ptr(aTHX))
 #undef  PL_replgv
 #define PL_replgv              (*Perl_Ireplgv_ptr(aTHX))
 #undef  PL_rsfp
diff --git a/sv.c b/sv.c
index bef60fa..b31a876 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11365,7 +11365,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     PL_glob_index      = proto_perl->Iglob_index;
     PL_srand_called    = proto_perl->Isrand_called;
     PL_hash_seed       = proto_perl->Ihash_seed;
-    PL_new_hash_seed   = proto_perl->Inew_hash_seed;
+    PL_rehash_seed     = proto_perl->Irehash_seed;
     PL_uudmap['M']     = 0;            /* reinits on demand */
     PL_bitcount                = Nullch;       /* reinits on demand */
 
index e877b31..83df6c5 100644 (file)
@@ -188,7 +188,7 @@ XS(XS_Internals_hv_clear_placehold);
 XS(XS_PerlIO_get_layers);
 XS(XS_Regexp_DESTROY);
 XS(XS_Internals_hash_seed);
-XS(XS_Internals_new_hash_seed);
+XS(XS_Internals_rehash_seed);
 XS(XS_Internals_HvREHASH);
 
 void
@@ -234,8 +234,7 @@ Perl_boot_core_UNIVERSAL(pTHX)
                XS_PerlIO_get_layers, file, "*;@");
     newXS("Regexp::DESTROY", XS_Regexp_DESTROY, file);
     newXSproto("Internals::hash_seed",XS_Internals_hash_seed, file, "");
-    newXSproto("Internals::new_hash_seed",XS_Internals_new_hash_seed, file,
-              "");
+    newXSproto("Internals::rehash_seed",XS_Internals_rehash_seed, file, "");
     newXSproto("Internals::HvREHASH", XS_Internals_HvREHASH, file, "\\%");
 }
 
@@ -921,12 +920,12 @@ XS(XS_Internals_hash_seed)
     XSRETURN_UV(PERL_HASH_SEED);
 }
 
-XS(XS_Internals_new_hash_seed)
+XS(XS_Internals_rehash_seed)
 {
     /* Using dXSARGS would also have dITEM and dSP,
      * which define 2 unused local variables.  */
     dMARK; dAX;
-    XSRETURN_UV(PL_new_hash_seed);
+    XSRETURN_UV(PL_rehash_seed);
 }
 
 XS(XS_Internals_HvREHASH)      /* Subject to change  */
diff --git a/util.c b/util.c
index b196d9b..4a1a45f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -4427,7 +4427,7 @@ Perl_get_hash_seed(pTHX)
                  Perl_croak(aTHX_ "Your random numbers are not that random");
          }
      }
-     PL_new_hash_seed_set = TRUE;
+     PL_rehash_seed_set = TRUE;
 
      return myseed;
 }