diff libinterp/corefcn/dynamic-ld.cc @ 20962:3aa293be0e8d

maint: Invert simple conditionals in if/else/error paradigm. Invert conditional in if statement and place error next to if. Delete else, and decrease code indent by 4. * cellfun.cc, data.cc, debug.cc, dirfns.cc, dynamic-ld.cc, file-io.cc, gl2ps-renderer.cc, graphics.cc, graphics.in.h, hex2num.cc, load-save.cc, ls-mat-ascii.cc, ls-oct-text.cc, oct-hist.cc, oct-lvalue.cc, oct-map.cc, toplev.cc, __init_fltk__.cc, ov-base-int.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc, ov-cx-mat.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-oncleanup.cc, ov-re-mat.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.cc, ov.cc, pt-arg-list.cc, pt-assign.cc, pt-colon.cc, pt-eval.cc, pt-exp.cc: Invert conditional in if statement and place error next to if. Delete else, and decrease code indent by 4.
author Rik <rik@octave.org>
date Tue, 22 Dec 2015 10:29:22 -0800
parents 35241c4b696c
children f569ba0ee237
line wrap: on
line diff
--- a/libinterp/corefcn/dynamic-ld.cc	Tue Dec 22 07:43:44 2015 -0500
+++ b/libinterp/corefcn/dynamic-ld.cc	Tue Dec 22 10:29:22 2015 -0800
@@ -266,32 +266,30 @@
         octave_shlib_list::append (oct_file);
     }
 
-  if (oct_file)
-    {
-      void *function = oct_file.search (fcn_name, name_mangler);
+  if (! oct_file)
+    error ("%s is not a valid shared library", file_name.c_str ());
+
+  void *function = oct_file.search (fcn_name, name_mangler);
 
-      if (! function)
-        {
-          // FIXME: can we determine this C mangling scheme
-          // automatically at run time or configure time?
-
-          function = oct_file.search (fcn_name, name_uscore_mangler);
-        }
+  if (! function)
+    {
+      // FIXME: can we determine this C mangling scheme
+      // automatically at run time or configure time?
 
-      if (function)
-        {
-          octave_dld_fcn_getter f
-            = FCN_PTR_CAST (octave_dld_fcn_getter, function);
-
-          retval = f (oct_file, relative);
+      function = oct_file.search (fcn_name, name_uscore_mangler);
+    }
 
-          if (! retval)
-            error ("failed to install .oct file function '%s'",
-                   fcn_name.c_str ());
-        }
+  if (function)
+    {
+      octave_dld_fcn_getter f
+        = FCN_PTR_CAST (octave_dld_fcn_getter, function);
+
+      retval = f (oct_file, relative);
+
+      if (! retval)
+        error ("failed to install .oct file function '%s'",
+               fcn_name.c_str ());
     }
-  else
-    error ("%s is not a valid shared library", file_name.c_str ());
 
   return retval;
 }
@@ -322,39 +320,35 @@
         octave_shlib_list::append (mex_file);
     }
 
-  if (mex_file)
-    {
-      void *function = 0;
+  if (! mex_file)
+    error ("%s is not a valid shared library", file_name.c_str ());
+
+  void *function = 0;
+
+  bool have_fmex = false;
 
-      bool have_fmex = false;
+  function = mex_file.search (fcn_name, mex_mangler);
 
-      function = mex_file.search (fcn_name, mex_mangler);
+  if (! function)
+    {
+      // FIXME: can we determine this C mangling scheme
+      // automatically at run time or configure time?
+
+      function = mex_file.search (fcn_name, mex_uscore_mangler);
 
       if (! function)
         {
-          // FIXME: can we determine this C mangling scheme
-          // automatically at run time or configure time?
-
-          function = mex_file.search (fcn_name, mex_uscore_mangler);
-
-          if (! function)
-            {
-              function = mex_file.search (fcn_name, mex_f77_mangler);
+          function = mex_file.search (fcn_name, mex_f77_mangler);
 
-              if (function)
-                have_fmex = true;
-            }
+          if (function)
+            have_fmex = true;
         }
+    }
 
-      if (function)
-        retval = new octave_mex_function (function, have_fmex,
-                                          mex_file, fcn_name);
-      else
-        error ("failed to install .mex file function '%s'",
-               fcn_name.c_str ());
-    }
+  if (function)
+    retval = new octave_mex_function (function, have_fmex, mex_file, fcn_name);
   else
-    error ("%s is not a valid shared library", file_name.c_str ());
+    error ("failed to install .mex file function '%s'", fcn_name.c_str ());
 
   return retval;
 }