summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-10-31 07:34:02 +0000
committerNicholas Clark <nick@ccl4.org>2008-10-31 07:34:02 +0000
commit260890edab60aa2cfcb8de6aa9ee77abafa96e24 (patch)
treedd72404639016745f5c57b97a7a9acfe402eeb59
parentb7e2d8c7ee3fc7b6a5f72d396258e399e0b648e6 (diff)
downloadperl-260890edab60aa2cfcb8de6aa9ee77abafa96e24.tar.gz
sizeof(const SV *) is the same as sizeof(SV *), except that it doesn't
match my regexp for non-const casts. p4raw-id: //depot/perl@34677
-rw-r--r--av.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/av.c b/av.c
index 7bd19eea5a..9ae95ae36e 100644
--- a/av.c
+++ b/av.c
@@ -134,7 +134,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
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 @@ Perl_av_extend(pTHX_ AV *av, I32 key)
#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;