changeset 26392:9ec0a1e5d4d3 stable

__ode15__.cc: Fix static analyzer detected issues (bug #55347). * __ode15__.cc (F__ode15__): Declare and assign *ida_fcn in one statement. Use comparison to UNSORTED rather than "! issorted ()" since return value is an enum, not bool.
author Rik <rik@octave.org>
date Wed, 02 Jan 2019 21:44:56 -0800
parents 3774259dd114
children 1e3c42fbf4d3
files libinterp/dldfcn/__ode15__.cc
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__ode15__.cc	Wed Jan 02 20:50:15 2019 -0800
+++ b/libinterp/dldfcn/__ode15__.cc	Wed Jan 02 21:44:56 2019 -0800
@@ -1132,14 +1132,12 @@
     print_usage ();
 
   // Check odefun
-  octave_function *ida_fcn = nullptr;
-
   octave_value f_arg = args(0);
 
   if (! f_arg.is_function_handle ())
     error ("__ode15__: odefun must be a function handle");
 
-  ida_fcn = f_arg.function_value ();
+  octave_function *ida_fcn = f_arg.function_value ();
 
   // Check input tspan
   ColumnVector tspan
@@ -1151,7 +1149,7 @@
 
   if (numt < 2)
     error ("__ode15__: TRANGE must contain at least 2 elements");
-  else if (! tspan.issorted () || tspan(0) == tspan(numt - 1))
+  else if (tspan.issorted () == UNSORTED || tspan(0) == tspan(numt - 1))
     error ("__ode15__: TRANGE must be strictly monotonic");
 
   // input y0 and yp0