Mercurial > hg > octave-jordi
changeset 20955:850e3d2533d4
maint: Eliminate more useless statements after error().
* __ilu__.cc, display.cc, file-io.cc, graphics.cc, graphics.in.h, hex2num.cc,
load-save.cc, ls-mat-ascii.cc, oct-errno.in.cc, pager.cc, sighandlers.cc,
sub2ind.cc, symtab.h, syscalls.cc, toplev.h, txt-eng-ft.cc, __eigs__.cc,
ov-bool-mat.cc, ov-classdef.h, ov-cx-mat.cc, ov-fcn-handle.cc,
ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-re-mat.cc, ov-str-mat.cc, ov-struct.cc,
ov-typeinfo.cc, ov-usr-fcn.cc:
maint: Eliminate more useless statements after error().
line wrap: on
line diff
--- a/libinterp/corefcn/__ilu__.cc +++ b/libinterp/corefcn/__ilu__.cc @@ -109,16 +109,10 @@ for (jj = uptr[k] + 1; jj < cidx[k+1]; jj++) data[jj] /= data[uptr[k]]; if (k != jrow) - { - error ("ilu: A has a zero on the diagonal"); - break; - } + error ("ilu: A has a zero on the diagonal"); if (data[j] == T(0)) - { - error ("ilu: encountered a pivot equal to 0"); - break; - } + error ("ilu: encountered a pivot equal to 0"); for (i = j1; i <= j2; i++) iw[ridx[i]] = -1; } @@ -351,10 +345,7 @@ // Check if the pivot is zero if (data_u[total_len_u] == zero) - { - error ("ilu: encountered a pivot equal to 0"); - break; - } + error ("ilu: encountered a pivot equal to 0"); // Scale the elements in L by the pivot for (i = total_len_l ; i < (total_len_l + w_len_l); i++) @@ -366,10 +357,7 @@ // Check if there are too many elements to be indexed with // octave_idx_type type due to fill-in during the process. if (total_len_l < 0 || total_len_u < 0) - { - error ("ilu: integer overflow. Too many fill-in elements in L or U"); - break; - } + error ("ilu: integer overflow. Too many fill-in elements in L or U"); cidx_u[k+1] = cidx_u[k] - cidx_u[0] + w_len_u; cidx_l[k+1] = cidx_l[k] - cidx_l[0] + w_len_l; @@ -776,10 +764,7 @@ iw_u.insert (k); } else - { - error ("ilu: encountered a pivot equal to 0"); - break; - } + error ("ilu: encountered a pivot equal to 0"); } // Scale the elements on the L part for IKJ version (milu = [col|off]) @@ -839,10 +824,7 @@ // Check if there are too many elements to be indexed with // octave_idx_type type due to fill-in during the process. if (total_len_l < 0 || total_len_u < 0) - { - error ("ilu: Integer overflow. Too many fill-in elements in L or U"); - break; - } + error ("ilu: Integer overflow. Too many fill-in elements in L or U"); if (opt == ROW) uptr[k] = total_len_u - 1; cidx_u[k+1] = cidx_u[k] - cidx_u[0] + w_len_u;
--- a/libinterp/corefcn/display.cc +++ b/libinterp/corefcn/display.cc @@ -63,11 +63,7 @@ } if (! instance) - { - error ("unable to create display_info object!"); - - retval = false; - } + error ("unable to create display_info object!"); return retval; }
--- a/libinterp/corefcn/file-io.cc +++ b/libinterp/corefcn/file-io.cc @@ -1881,10 +1881,7 @@ { tmp = x % obase; if (tmp > ibase - 1) - { - error ("umask: invalid digit"); - break; - } + error ("umask: invalid digit"); retval += mult * tmp; mult *= ibase; }
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -99,10 +99,8 @@ size_t num_matches = matches.size (); if (num_matches == 0) - { - error ("%s: unknown %s property %s", - who.c_str (), what.c_str (), pname.c_str ()); - } + error ("%s: unknown %s property %s", + who.c_str (), what.c_str (), pname.c_str ()); else if (num_matches > 1) { string_vector sv (matches); @@ -2216,10 +2214,8 @@ const Cell& values, octave_idx_type row) { if (pnames.numel () != values.columns ()) - { - error ("set: number of names must match number of value columns (%d != %d)", - pnames.numel (), values.columns ()); - } + error ("set: number of names must match number of value columns (%d != %d)", + pnames.numel (), values.columns ()); octave_idx_type k = pnames.columns (); @@ -10816,13 +10812,11 @@ if (val.compare ("expose")) do_events = false; else - { - error ("drawnow: invalid argument, 'expose' is only valid option"); - - gh_manager::unlock (); - - return ovl (); - } + { + gh_manager::unlock (); + + error ("drawnow: invalid argument, 'expose' is only valid option"); + } } if (do_events) @@ -10878,15 +10872,14 @@ file_stat fs (dirname); - if (! (fs && fs.is_dir ())) + if (! fs || ! fs.is_dir ()) { + gh_manager::unlock (); + error ("drawnow: nonexistent directory '%s'", dirname.c_str ()); - - gh_manager::unlock (); - - return ovl (); } + } }
--- a/libinterp/corefcn/graphics.in.h +++ b/libinterp/corefcn/graphics.in.h @@ -854,10 +854,7 @@ bool retval = true; if (! contains (val, match)) - { - error ("invalid value = %s", val.c_str ()); - retval = false; - } + error ("invalid value = %s", val.c_str ()); return retval; } @@ -2339,11 +2336,7 @@ create_instance (); if (! instance) - { - error ("unable to create gh_manager!"); - - retval = false; - } + error ("unable to create gh_manager!"); return retval; } @@ -2726,9 +2719,7 @@ if (valid_object ()) return get_properties ().get (all); else - { - error ("base_graphics_object::get: invalid graphics object"); - } + error ("base_graphics_object::get: invalid graphics object"); } virtual octave_value get (const caseless_str& pname) const @@ -2736,9 +2727,7 @@ if (valid_object ()) return get_properties ().get (pname); else - { - error ("base_graphics_object::get: invalid graphics object"); - } + error ("base_graphics_object::get: invalid graphics object"); } virtual octave_value get_default (const caseless_str&) const; @@ -2783,9 +2772,7 @@ if (valid_object ()) return get_properties ().get_parent (); else - { - error ("base_graphics_object::get_parent: invalid graphics object"); - } + error ("base_graphics_object::get_parent: invalid graphics object"); } graphics_handle get_handle (void) const @@ -2793,9 +2780,7 @@ if (valid_object ()) return get_properties ().get___myhandle__ (); else - { - error ("base_graphics_object::get_handle: invalid graphics object"); - } + error ("base_graphics_object::get_handle: invalid graphics object"); } virtual void remove_child (const graphics_handle& h) @@ -2870,9 +2855,7 @@ if (valid_object ()) return get_properties ().get_toolkit (); else - { - error ("base_graphics_object::get_toolkit: invalid graphics object"); - } + error ("base_graphics_object::get_toolkit: invalid graphics object"); } virtual void add_property_listener (const std::string& nm, @@ -5904,11 +5887,7 @@ create_instance (); if (! instance) - { - error ("unable to create gh_manager!"); - - retval = false; - } + error ("unable to create gh_manager!"); return retval; }
--- a/libinterp/corefcn/hex2num.cc +++ b/libinterp/corefcn/hex2num.cc @@ -116,10 +116,7 @@ num.ival += static_cast<uint32_t> (ch - '0'); } else - { - error ("hex2num: illegal character found in string S"); - break; - } + error ("hex2num: illegal character found in string S"); } if (nc < nchars)
--- a/libinterp/corefcn/load-save.cc +++ b/libinterp/corefcn/load-save.cc @@ -863,10 +863,9 @@ } } else - { - error ("load: unable to determine file format of '%s'", - orig_fname.c_str ()); - } + error ("load: unable to determine file format of '%s'", + orig_fname.c_str ()); + } return retval;
--- a/libinterp/corefcn/ls-mat-ascii.cc +++ b/libinterp/corefcn/ls-mat-ascii.cc @@ -317,13 +317,8 @@ break; } else - { - error ("load: failed to read matrix from file '%s'", - filename.c_str ()); - - return retval; - } - + error ("load: failed to read matrix from file '%s'", + filename.c_str ()); } } }
--- a/libinterp/corefcn/oct-errno.in.cc +++ b/libinterp/corefcn/oct-errno.in.cc @@ -302,11 +302,7 @@ } if (! instance) - { - error ("unable to create errno object!"); - - retval = false; - } + error ("unable to create errno object!"); return retval; }
--- a/libinterp/corefcn/pager.cc +++ b/libinterp/corefcn/pager.cc @@ -380,11 +380,7 @@ } if (! instance) - { - error ("unable to create pager_stream object!"); - - retval = false; - } + error ("unable to create pager_stream object!"); return retval; } @@ -445,11 +441,7 @@ } if (! instance) - { - error ("unable to create diary_stream object!"); - - retval = false; - } + error ("unable to create diary_stream object!"); return retval; }
--- a/libinterp/corefcn/sighandlers.cc +++ b/libinterp/corefcn/sighandlers.cc @@ -198,11 +198,7 @@ } if (! instance) - { - error ("unable to create w32_interrupt_manager"); - - retval = false; - } + error ("unable to create w32_interrupt_manager"); return retval; } @@ -928,11 +924,7 @@ } if (! instance) - { - error ("unable to create child list object!"); - - retval = false; - } + error ("unable to create child list object!"); return retval; }
--- a/libinterp/corefcn/sub2ind.cc +++ b/libinterp/corefcn/sub2ind.cc @@ -53,10 +53,7 @@ if (ii == dimsv(i) && ii >= 0) dv(i) = ii; else - { - error ("%s: dimension vector DIMS must contain integers", name); - break; - } + error ("%s: dimension vector DIMS must contain integers", name); } }
--- a/libinterp/corefcn/symtab.h +++ b/libinterp/corefcn/symtab.h @@ -93,11 +93,7 @@ create_instance (); if (! instance) - { - error ("unable to create scope_id_cache object!"); - - retval = false; - } + error ("unable to create scope_id_cache object!"); return retval; }
--- a/libinterp/corefcn/syscalls.cc +++ b/libinterp/corefcn/syscalls.cc @@ -648,10 +648,7 @@ { tmp = x % obase; if (tmp > ibase - 1) - { - error ("mkfifo: invalid digit"); - break; - } + error ("mkfifo: invalid digit"); retval += mult * tmp; mult *= ibase; }
--- a/libinterp/corefcn/toplev.h +++ b/libinterp/corefcn/toplev.h @@ -135,11 +135,7 @@ create_instance (); if (! instance) - { - error ("unable to create call stack object!"); - - retval = false; - } + error ("unable to create call stack object!"); return retval; }
--- a/libinterp/corefcn/txt-eng-ft.cc +++ b/libinterp/corefcn/txt-eng-ft.cc @@ -89,11 +89,7 @@ } if (! instance) - { - error ("unable to create ft_manager!"); - - retval = false; - } + error ("unable to create ft_manager!"); return retval; }
--- a/libinterp/dldfcn/__eigs__.cc +++ b/libinterp/dldfcn/__eigs__.cc @@ -192,12 +192,7 @@ call_depth++; if (call_depth > 1) - { - error ("eigs: invalid recursive call"); - if (fcn_name.length ()) - clear_function (fcn_name); - return retval; - } + error ("eigs: invalid recursive call"); if (args(0).is_function_handle () || args(0).is_inline_function () || args(0).is_string ())
--- a/libinterp/octave-value/ov-bool-mat.cc +++ b/libinterp/octave-value/ov-bool-mat.cc @@ -296,19 +296,13 @@ panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); } else panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); return success; }
--- a/libinterp/octave-value/ov-classdef.h +++ b/libinterp/octave-value/ov-classdef.h @@ -1615,11 +1615,7 @@ create_instance (); if (! instance) - { - error ("unable to create cdef_manager!"); - - retval = false; - } + error ("unable to create cdef_manager!"); return retval; }
--- a/libinterp/octave-value/ov-cx-mat.cc +++ b/libinterp/octave-value/ov-cx-mat.cc @@ -420,19 +420,13 @@ panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); } else panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); return success; }
--- a/libinterp/octave-value/ov-fcn-handle.cc +++ b/libinterp/octave-value/ov-fcn-handle.cc @@ -453,10 +453,7 @@ = read_text_data (is, std::string (), dummy, t2, i); if (! is) - { - error ("load: failed to load anonymous function handle"); - break; - } + error ("load: failed to load anonymous function handle"); symbol_table::assign (name, t2, local_scope, 0); } @@ -638,10 +635,7 @@ dummy, t2, doc); if (! is) - { - error ("load: failed to load anonymous function handle"); - break; - } + error ("load: failed to load anonymous function handle"); symbol_table::assign (name, t2, local_scope); }
--- a/libinterp/octave-value/ov-flt-cx-mat.cc +++ b/libinterp/octave-value/ov-flt-cx-mat.cc @@ -394,19 +394,13 @@ panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); } else panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); return success; }
--- a/libinterp/octave-value/ov-flt-re-mat.cc +++ b/libinterp/octave-value/ov-flt-re-mat.cc @@ -421,19 +421,13 @@ panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); } else panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); return success; }
--- a/libinterp/octave-value/ov-re-mat.cc +++ b/libinterp/octave-value/ov-re-mat.cc @@ -523,19 +523,13 @@ panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); } else panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); return success; }
--- a/libinterp/octave-value/ov-str-mat.cc +++ b/libinterp/octave-value/ov-str-mat.cc @@ -377,10 +377,7 @@ } } else - { - error ("load: failed to read dimensions"); - success = false; - } + error ("load: failed to read dimensions"); } else error ("load: failed to extract matrix size"); @@ -407,11 +404,7 @@ char *ptmp = tmp.fortran_vec (); if (len > 0 && ! is.read (ptmp, len)) - { - error ("load: failed to load string constant"); - success = false; - break; - } + error ("load: failed to load string constant"); else { if (len > max_len) @@ -424,11 +417,8 @@ } } else - { - error ("load: failed to extract string length for element %d", - i+1); - success = false; - } + error ("load: failed to extract string length for element %d", + i+1); } matrix = chm; @@ -451,9 +441,7 @@ char *ptmp = tmp.fortran_vec (); if (len > 0 && ! is.read (ptmp, len)) - { - error ("load: failed to load string constant"); - } + error ("load: failed to load string constant"); else { if (is) @@ -467,10 +455,7 @@ panic_impossible (); } else - { - error ("load: failed to extract number of rows and columns"); - success = false; - } + error ("load: failed to extract number of rows and columns"); return success; }
--- a/libinterp/octave-value/ov-struct.cc +++ b/libinterp/octave-value/ov-struct.cc @@ -763,10 +763,7 @@ panic_impossible (); } else - { - error ("load: failed to extract number of elements in structure"); - success = false; - } + error ("load: failed to extract number of elements in structure"); return success; } @@ -1405,10 +1402,7 @@ panic_impossible (); } else - { - error ("load: failed to extract number of elements in structure"); - success = false; - } + error ("load: failed to extract number of elements in structure"); return success; }
--- a/libinterp/octave-value/ov-typeinfo.cc +++ b/libinterp/octave-value/ov-typeinfo.cc @@ -51,11 +51,7 @@ } if (! instance) - { - error ("unable to create value type info object!"); - - retval = false; - } + error ("unable to create value type info object!"); return retval; }
--- a/libinterp/octave-value/ov-usr-fcn.cc +++ b/libinterp/octave-value/ov-usr-fcn.cc @@ -531,11 +531,9 @@ if (ret_list) ret_list->define_from_arg_vector (ret_args); else - { - error ("%s: invalid classdef constructor, no output argument defined", - dispatch_class ().c_str ()); - return retval; - } + error ("%s: invalid classdef constructor, no output argument defined", + dispatch_class ().c_str ()); + } // Force parameter list to be undefined when this function exits.