With respect to the odd corruption seen previously on VMS, but now no longer
visible, might this patch have had something to do with it? I believe that
the change I made was correct. If so, then because it removed a large over-
allocation, it will show up any other code that failed to allocate sufficient
space, hence revealing latent bugs elsewhere.

Nicholas Clark
----- Forwarded message from Nicholas Clark <[EMAIL PROTECTED]> -----

Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Post: <mailto:perl5-changes@perl.org>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
List-Subscribe: <mailto:[EMAIL PROTECTED]>
List-Id: <perl5-changes.perl.org>
Delivered-To: mailing list perl5-changes@perl.org
Delivered-To: perl5-changes@perl.org
X-Spam-Status: No, hits=-2.6 required=8.0
        tests=BAYES_00,UPPERCASE_25_50
X-Spam-Check-By: la.mx.develooper.com
Date: Wed, 1 Jun 2005 08:43:38 -0700
From: Nicholas Clark <[EMAIL PROTECTED]>
To: "Anybody And Everybody" <perl5-changes@perl.org>
Subject: Change 24661: As PERL_HV_ARRAY_ALLOC_BYTES is bytes, not items, the 
type should be

Change 24661 by [EMAIL PROTECTED] on 2005/06/01 15:08:02

        As PERL_HV_ARRAY_ALLOC_BYTES is bytes, not items, the type should be
        char rather than HE *. Bug was harmless, overallocating by a factor
        of sizeof(HE *)

Affected files ...

... //depot/perl/hv.c#221 edit

Differences ...

==== //depot/perl/hv.c#221 (text) ====
Index: perl/hv.c
--- perl/hv.c#220~24660~        Wed Jun  1 07:33:14 2005
+++ perl/hv.c   Wed Jun  1 08:08:02 2005
@@ -603,10 +603,13 @@
 #ifdef DYNAMIC_ENV_FETCH  /* if it's an %ENV lookup, we may get it on the fly 
*/
                 || (SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env))
 #endif
-                                                                 )
-           Newz(503, HvARRAY(hv),
+                                                                 ) {
+           char *array;
+           Newz(503, array,
                 PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
-                HE*);
+                char);
+           HvARRAY(hv) = (HE**)array;
+       }
 #ifdef DYNAMIC_ENV_FETCH
        else if (action & HV_FETCH_ISEXISTS) {
            /* for an %ENV exists, if we do an insert it's by a recursive
@@ -773,9 +776,11 @@
        /* Not sure if we can get here.  I think the only case of oentry being
           NULL is for %ENV with dynamic env fetch.  But that should disappear
           with magic in the previous code.  */
-       Newz(503, HvARRAY(hv),
+       char *array;
+       Newz(503, array,
             PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
-            HE*);
+            char);
+       HvARRAY(hv) = (HE**)array;
     }
 
     oentry = &(HvARRAY(hv))[hash & (I32) xhv->xhv_max];
End of Patch.


----- End forwarded message -----

Reply via email to