From a20818be9ec660588af325d82e515ebb75bd9905 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 11 Sep 2019 01:11:04 +0300 Subject: Workaround 'argument to function is always 1' cppcheck false positives * allchblk.c (GC_print_hblkfreelist): Replace "while(p!=0)" with "while(p)"; add a marker that the change is for cppcheck. * allchblk.c (GC_free_block_ending_at, GC_add_to_fl, GC_split_block, GC_allochblk_nth, GC_freehblk): Replace "if(p!=0)" with "if(p)". * alloc.c (GC_set_fl_marks): Likewise. * extra/MacOS.c (GC_MacFreeTemporaryMemory): Likewise. * mallocx.c (GC_generic_malloc_many): Likewise. * allchblk.c (GC_allochblk_nth): Replace "if(0==p)" with "if(p){}else". * malloc.c (GC_free): Likewise. * malloc.c (GC_generic_malloc_uncollectable): Replace "if(0==p)return 0;;return p;" with "if(p){}return p;". * mallocx.c (GC_generic_malloc_many): Replace "p+=v;while((p2=*p)!=0)" with "for(p+=v;(p2=*p)!=0;)". * reclaim.c (GC_continue_reclaim, GC_reclaim_all): Likewise. --- extra/MacOS.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/MacOS.c b/extra/MacOS.c index 624b383d..363b40ec 100644 --- a/extra/MacOS.c +++ b/extra/MacOS.c @@ -126,7 +126,7 @@ void GC_MacFreeTemporaryMemory(void) long totalMemoryUsed = 0; # endif TemporaryMemoryHandle tempMemBlock = theTemporaryMemory; - while (tempMemBlock != NULL) { + while (tempMemBlock /* != NULL */) { TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock; # if !defined(SHARED_LIBRARY_BUILD) totalMemoryUsed += GetHandleSize((Handle)tempMemBlock); -- cgit v1.2.1