]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Remove some unneded checks as identified by IBM's BEAM checker.
authorFlorian Krohm <florian@eich-krohm.de>
Thu, 11 Sep 2014 22:15:39 +0000 (22:15 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Thu, 11 Sep 2014 22:15:39 +0000 (22:15 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14518

cachegrind/cg_merge.c
callgrind/dump.c
coregrind/m_main.c
coregrind/m_mallocfree.c
coregrind/m_scheduler/sched-lock-generic.c
drd/drd_thread.c

index e1d67a7f64c9a0ead2a619edb377a5c0b69b7031..5b03f0cb63913f7dbbfdc12a9ea7c9e0f663296b 100644 (file)
@@ -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);
index 5cc1d27296026dade33408c2913c91f983b6f3e1..f52b840c85ea9d468c0d3d96ab9e2342741e6657 100644 (file)
@@ -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,
index 743aad6d1495a9a5cb54ab4066567f53bd8cd788..d1cc392e4728a5ed5104eac038d8477a63fdf3a9 100644 (file)
@@ -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");
 
index 9e42c2540385628a0bff997c6a11f68334937762..c05cc0c77586f8b31878f5f8309d19e1b12633d9 100644 (file)
@@ -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 );
index eb1230bc705a681b56eff1bd54a5867fae93020c..939bc4fe45ec3d09a1b1d2fdaef5a58f9904f480 100644 (file)
@@ -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;
 }
 
index 5e53a53f6cd099c6ac709700e11b2a31ab698d03..6dac42791e7c0f9bc1f9e9ae4d9a43b12c918794 100644 (file)
@@ -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);