[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-changes
Subject:    Change 34677: sizeof(const SV *) is the same as sizeof(SV *), except that it doesn't
From:       Nicholas Clark <nwc10+p5p4 () colon ! colondot ! net>
Date:       2008-10-31 7:45:02
Message-ID: 20081031074502.5B91014002 () mx ! activestate ! com
[Download RAW message or body]

Change 34677 by nicholas@nicholas-saigo on 2008/10/31 07:34:02

	sizeof(const SV *) is the same as sizeof(SV *), except that it doesn't
	match my regexp for non-const casts.

Affected files ...

... //depot/perl/av.c#139 edit

Differences ...

==== //depot/perl/av.c#139 (text) ====
Index: perl/av.c
--- perl/av.c#138~34675~	2008-10-30 16:22:31.000000000 -0700
+++ perl/av.c	2008-10-31 00:34:02.000000000 -0700
@@ -134,7 +134,7 @@
 		   the current lazy system of only writing to it if our caller
 		   has a need for more space. NWC  */
 		newmax = Perl_safesysmalloc_size((void*)AvALLOC(av)) /
-		    sizeof(SV*) - 1;
+		    sizeof(const SV *) - 1;
 
 		if (key <= newmax) 
 		    goto resized;
@@ -145,20 +145,21 @@
 #if defined(STRANGE_MALLOC) || defined(MYMALLOC)
 		Renew(AvALLOC(av),newmax+1, SV*);
 #else
-		bytes = (newmax + 1) * sizeof(SV*);
+		bytes = (newmax + 1) * sizeof(const SV *);
 #define MALLOC_OVERHEAD 16
 		itmp = MALLOC_OVERHEAD;
 		while ((MEM_SIZE)(itmp - MALLOC_OVERHEAD) < bytes)
 		    itmp += itmp;
 		itmp -= MALLOC_OVERHEAD;
-		itmp /= sizeof(SV*);
+		itmp /= sizeof(const SV *);
 		assert(itmp > newmax);
 		newmax = itmp - 1;
 		assert(newmax >= AvMAX(av));
 		Newx(ary, newmax+1, SV*);
 		Copy(AvALLOC(av), ary, AvMAX(av)+1, SV*);
 		if (AvMAX(av) > 64)
-		    offer_nice_chunk(AvALLOC(av), (AvMAX(av)+1) * sizeof(SV*));
+		    offer_nice_chunk(AvALLOC(av),
+				     (AvMAX(av)+1) * sizeof(const SV *));
 		else
 		    Safefree(AvALLOC(av));
 		AvALLOC(av) = ary;
End of Patch.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic