summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-03-15 03:48:48 +0000
committerAndrew Clayton <a.clayton@nginx.com>2023-04-03 14:53:04 +0100
commit485205712433611ee9939a869b4f734f824a177a (patch)
tree8527a9779f6f77bc55a3b04518123273008e9ce1
parent8a9e078e5427e2b72e178740f25cbcebb780b225 (diff)
downloadunit-485205712433611ee9939a869b4f734f824a177a.tar.gz
unit-485205712433611ee9939a869b4f734f824a177a.tar.bz2
Remove a useless assignment in nxt_mem_zone_alloc_pages().
This was reported by the 'Clang Static Analyzer' as a 'dead nested assignment'. We assign prev_size then check if it's != 0 and if true we then set prev_pages to page_size right shifted by two at the same time setting prev_size to be right shifted by two (>>=), however page_size is never used again so no need to set it here. Reviewed-by: Alejandro Colomar <alx@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
-rw-r--r--src/nxt_mem_zone.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nxt_mem_zone.c b/src/nxt_mem_zone.c
index f8ab09d9..a3ba3700 100644
--- a/src/nxt_mem_zone.c
+++ b/src/nxt_mem_zone.c
@@ -672,7 +672,7 @@ nxt_mem_zone_alloc_pages(nxt_mem_zone_t *zone, size_t alignment, uint32_t pages)
prev_size = p - (u_char *) block;
if (prev_size != 0) {
- prev_pages = prev_size >>= zone->page_size_shift;
+ prev_pages = prev_size >> zone->page_size_shift;
node_pages -= prev_pages;
block->size = prev_pages;