diff libinterp/corefcn/oct-map.cc @ 26566:f8d380d04b01 stable

Fix dead assignments found by clang static analysis (bug #55440). * find.cc (Ffind): Delete "direction = 0;" assignment. * oct-map.cc (octave_fields::equal_up_to_order): Declare, but don't bother to initialize retval. If mismatch is found, return false directly to jump out of loop. * oct-stream.cc (printf_format_list::printf_format_list): Delete "empty_buf = false;" * oct-stream.cc (textscan::scan_complex): delete unnecessary call to is.tellg () to get pos which is never used. * regexp.cc (do_regexp_ptn_string_escapes): Delete "bad_esc_seq = true;". * ov-java.cc (unbox): Delete "found = false;".
author Rik <rik@octave.org>
date Thu, 17 Jan 2019 08:04:53 -0800
parents 00f796120a6d
children 04e5cb5e2cb3 2310164737b3
line wrap: on
line diff
--- a/libinterp/corefcn/oct-map.cc	Wed Jan 16 20:32:15 2019 -0800
+++ b/libinterp/corefcn/oct-map.cc	Thu Jan 17 08:04:53 2019 -0800
@@ -124,7 +124,7 @@
 octave_fields::equal_up_to_order (const octave_fields& other,
                                   octave_idx_type *perm) const
 {
-  bool retval = true;
+  bool retval;
 
   auto p = begin ();
   auto q = other.begin ();
@@ -133,10 +133,7 @@
       if (p->first == q->first)
         perm[p->second] = q->second;
       else
-        {
-          retval = false;
-          break;
-        }
+        return false;
     }
 
   retval = (p == end () && q == other.end ());