Mercurial > octave
diff libinterp/corefcn/ls-oct-text.cc @ 20981:c11cea70b638
maint: invert if/else/error instances.
* input.cc, ls-mat-ascii.cc, ls-mat5.cc, ls-oct-text.cc:
Invert if/else/error instances.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 25 Dec 2015 00:36:19 -0500 |
parents | 3aa293be0e8d |
children | b9d4c3615e89 |
line wrap: on
line diff
--- a/libinterp/corefcn/ls-oct-text.cc Thu Dec 24 13:55:51 2015 -0500 +++ b/libinterp/corefcn/ls-oct-text.cc Fri Dec 25 00:36:19 2015 -0500 @@ -258,31 +258,29 @@ std::string tag = extract_keyword (is, "type"); - if (! tag.empty ()) - { - std::string typ; - size_t pos = tag.rfind (' '); + if (tag.empty ()) + error ("load: failed to extract keyword specifying value type"); - if (pos != std::string::npos) - { - global = SUBSTRING_COMPARE_EQ (tag, 0, 6, "global"); + std::string typ; + size_t pos = tag.rfind (' '); - typ = global ? tag.substr (7) : tag; - } - else - typ = tag; + if (pos != std::string::npos) + { + global = SUBSTRING_COMPARE_EQ (tag, 0, 6, "global"); - // Special case for backward compatibility. A small bit of cruft - if (SUBSTRING_COMPARE_EQ (typ, 0, 12, "string array")) - tc = charMatrix (); - else - tc = octave_value_typeinfo::lookup_type (typ); - - if (! tc.load_ascii (is)) - error ("load: trouble reading ascii file '%s'", filename.c_str ()); + typ = global ? tag.substr (7) : tag; } else - error ("load: failed to extract keyword specifying value type"); + typ = tag; + + // Special case for backward compatibility. A small bit of cruft + if (SUBSTRING_COMPARE_EQ (typ, 0, 12, "string array")) + tc = charMatrix (); + else + tc = octave_value_typeinfo::lookup_type (typ); + + if (! tc.load_ascii (is)) + error ("load: trouble reading ascii file '%s'", filename.c_str ()); return name; }