diff libinterp/corefcn/gammainc.cc @ 20616:fd0efcdb3718

use new string_value method to handle value extraction errors * dirfns.cc, file-io.cc, gammainc.cc, help.cc, load-path.cc, octave-link.cc, qz.cc, regexp.cc, strfns.cc, syscalls.cc, time.cc, variables.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Oct 2015 19:00:51 -0400
parents b10432a40432
children
line wrap: on
line diff
--- a/libinterp/corefcn/gammainc.cc	Thu Oct 08 17:55:57 2015 -0400
+++ b/libinterp/corefcn/gammainc.cc	Thu Oct 08 19:00:51 2015 -0400
@@ -85,18 +85,14 @@
 
   if (nargin == 3)
     {
-      if (args(2).is_string ())
-        {
-          std::string s = args(2).string_value ();
-          std::transform (s.begin (), s.end (), s.begin (), tolower);
-          if (s == "upper")
-            lower = false;
-          else if (s != "lower")
-            error ("gammainc: third argument must be \"lower\" or \"upper\"");
-        }
-      else
+      std::string s = args(2).string_value ("gammainc: third argument must be \"lower\" or \"upper\"");
+
+      std::transform (s.begin (), s.end (), s.begin (), tolower);
+
+      if (s == "upper")
+        lower = false;
+      else if (s != "lower")
         error ("gammainc: third argument must be \"lower\" or \"upper\"");
-
     }
 
   if (nargin < 2 || nargin > 3)