diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-03-29 15:06:50 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-05-18 20:26:54 +0100 |
commit | 4b1123b95676547d1127156b465c8067d112936e (patch) | |
tree | 92cad2668eaeacd605eb363cc30a887b059cb975 /util.c | |
parent | 72d749260665bf3a57913ccb056f7d8cba9a2d99 (diff) | |
download | perl-4b1123b95676547d1127156b465c8067d112936e.tar.gz |
In Perl_safesyscalloc(), only declare total_size if conditional code needs it.
gcc 4.6.0 warns about variables that are set but never read, and for most
combinations of conditional compilation options, total_size is never read.
So avoid declaring or setting it if it's not actually going to be used later.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -294,11 +294,16 @@ Perl_safesyscalloc(MEM_SIZE count, MEM_SIZE size) dTHX; #endif Malloc_t ptr; +#if defined(PERL_TRACK_MEMPOOL) || defined(HAS_64K_LIMIT) || defined(DEBUGGING) MEM_SIZE total_size = 0; +#endif /* Even though calloc() for zero bytes is strange, be robust. */ - if (size && (count <= MEM_SIZE_MAX / size)) + if (size && (count <= MEM_SIZE_MAX / size)) { +#if defined(PERL_TRACK_MEMPOOL) || defined(HAS_64K_LIMIT) || defined(DEBUGGING) total_size = size * count; +#endif + } else Perl_croak_nocontext("%s", PL_memory_wrap); #ifdef PERL_TRACK_MEMPOOL |