summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2014-06-14 20:11:54 +0400
committerIvan Maidanski <ivmai@mail.ru>2014-06-14 20:11:54 +0400
commit813a99e4f646a14c640eb08de7bf40f44235fc94 (patch)
treebb7740d3fd4b08662f80d2084288e1bb60b9d40a /headers.c
parent185027e9a4d9176197de1e462abda9a4c13002bd (diff)
downloadbdwgc-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/headers.c b/headers.c
index 361f19c1..057d989f 100644
--- a/headers.c
+++ b/headers.c
@@ -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) {