From: Florian Krohm Date: Thu, 11 Sep 2014 22:15:39 +0000 (+0000) Subject: Remove some unneded checks as identified by IBM's BEAM checker. X-Git-Tag: svn/VALGRIND_3_11_0~1012 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfb5d3fc36d45818a0a1d8af1742d708a09bc102;p=thirdparty%2Fvalgrind.git Remove some unneded checks as identified by IBM's BEAM checker. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14518 --- diff --git a/cachegrind/cg_merge.c b/cachegrind/cg_merge.c index e1d67a7f64..5b03f0cb63 100644 --- a/cachegrind/cg_merge.c +++ b/cachegrind/cg_merge.c @@ -741,10 +741,8 @@ static CacheProfFile* parse_CacheProfFile ( SOURCE* s ) // since the summary counts are OK, free up the summary_line text // which contains the same info. - if (cpf->summary_line) { - free(cpf->summary_line); - cpf->summary_line = NULL; - } + free(cpf->summary_line); + cpf->summary_line = NULL; free(curr_fn); free(curr_fl); diff --git a/callgrind/dump.c b/callgrind/dump.c index 5cc1d27296..f52b840c85 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -1501,7 +1501,7 @@ static void print_bbccs_of_thread(thread_info* ti) init_fpos(&lastFnPos); init_apos(&lastAPos, 0, 0, 0); - if (p) while(1) { + while(1) { /* on context/function change, print old cost buffer before */ if (lastFnPos.cxt && ((*p==0) || @@ -1557,7 +1557,7 @@ static void print_bbccs_of_thread(thread_info* ti) } close_dumpfile(print_fd); - if (array) VG_(free)(array); + VG_(free)(array); /* set counters of last dump */ CLG_(copy_cost)( CLG_(sets).full, ti->lastdump_cost, diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 743aad6d14..d1cc392e47 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1677,7 +1677,7 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) //-------------------------------------------------------------- VG_(debugLog)(1, "main", "Starting the dynamic memory manager\n"); { void* p = VG_(malloc)( "main.vm.1", 12345 ); - if (p) VG_(free)( p ); + VG_(free)( p ); } VG_(debugLog)(1, "main", "Dynamic memory manager is running\n"); diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index 9e42c25403..c05cc0c775 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -2574,6 +2574,7 @@ void* VG_(arena_perm_malloc) ( ArenaId aid, SizeT size, Int align ) // All just wrappers to avoid exposing arenas to tools. +// This function never returns NULL. void* VG_(malloc) ( const HChar* cc, SizeT nbytes ) { return VG_(arena_malloc) ( VG_AR_CORE, cc, nbytes ); diff --git a/coregrind/m_scheduler/sched-lock-generic.c b/coregrind/m_scheduler/sched-lock-generic.c index eb1230bc70..939bc4fe45 100644 --- a/coregrind/m_scheduler/sched-lock-generic.c +++ b/coregrind/m_scheduler/sched-lock-generic.c @@ -51,8 +51,7 @@ static struct sched_lock *create_sched_lock(void) struct sched_lock *p; p = VG_(malloc)("sched_lock", sizeof(*p)); - if (p) - ML_(sema_init)(&p->sema); + ML_(sema_init)(&p->sema); return p; } diff --git a/drd/drd_thread.c b/drd/drd_thread.c index 5e53a53f6c..6dac42791e 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -380,7 +380,7 @@ void DRD_(thread_post_join)(DrdThreadId drd_joiner, DrdThreadId drd_joinee) HChar* msg; msg = VG_(malloc)("drd.main.dptj.1", msg_size); - tl_assert(msg); + VG_(snprintf)(msg, msg_size, "drd_post_thread_join joiner = %d, joinee = %d", drd_joiner, drd_joinee);