diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2014-06-14 20:11:54 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2014-06-14 20:11:54 +0400 |
commit | 813a99e4f646a14c640eb08de7bf40f44235fc94 (patch) | |
tree | bb7740d3fd4b08662f80d2084288e1bb60b9d40a /headers.c | |
parent | 185027e9a4d9176197de1e462abda9a4c13002bd (diff) | |
download | bdwgc-813a99e4f646a14c640eb08de7bf40f44235fc94.tar.gz |
Fix 'redundant assignment to itself' Cppcheck warning in GC_scratch_alloc
* headers.c (GC_scratch_alloc): Do not reassign "bytes_to_get" local
variable to avoid compiler warning in case of ROUNDUP_PAGESIZE_IF_MMAP
is a no-op (i.e., assign bytes_to_get only once directly to a rounded
value).
Diffstat (limited to 'headers.c')
-rw-r--r-- | headers.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -128,8 +128,7 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes) return result; } - bytes_to_get = MINHINCR * HBLKSIZE; - if (bytes_to_get <= bytes) { + if (bytes >= MINHINCR * HBLKSIZE) { bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes); result = (ptr_t)GET_MEM(bytes_to_get); GC_add_to_our_memory(result, bytes_to_get); @@ -143,7 +142,8 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes) return result; } - bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes_to_get); /* for safety */ + bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(MINHINCR * HBLKSIZE); + /* round up for safety */ result = (ptr_t)GET_MEM(bytes_to_get); GC_add_to_our_memory(result, bytes_to_get); if (NULL == result) { |