changeset 29969:7a4f16bff8fd

use fewer OCTAVE_NAMESPACE_BEGIN/END blocks where possible * __magick_read__.cc, __delaunayn__.cc, __ode15__.cc, __voronoi__.cc: Place optional header files in separate #ifdef blocks from optional code so that a single OCTAVE_NAMESPACE_BEGIN/END pair can surround the entire code section of the file.
author John W. Eaton <jwe@octave.org>
date Sun, 15 Aug 2021 16:57:52 -0400
parents 7aa4d8c049e5
children 2af7339fa6d1
files libinterp/corefcn/__magick_read__.cc libinterp/dldfcn/__delaunayn__.cc libinterp/dldfcn/__ode15__.cc libinterp/dldfcn/__voronoi__.cc
diffstat 4 files changed, 15 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__magick_read__.cc	Sun Aug 15 15:15:55 2021 -0400
+++ b/libinterp/corefcn/__magick_read__.cc	Sun Aug 15 16:57:52 2021 -0400
@@ -39,12 +39,14 @@
 #include "errwarn.h"
 
 #if defined (HAVE_MAGICK)
-
-#include <Magick++.h>
-#include <clocale>
+#  include <Magick++.h>
+#  include <clocale>
+#endif
 
 OCTAVE_NAMESPACE_BEGIN
 
+#if defined (HAVE_MAGICK)
+
 // In theory, it should be enough to check the class:
 // Magick::ClassType
 // PseudoClass:
@@ -824,12 +826,8 @@
     }
 }
 
-OCTAVE_NAMESPACE_END
-
 #endif
 
-OCTAVE_NAMESPACE_BEGIN
-
 DEFUN (__magick_read__, args, nargout,
        doc: /* -*- texinfo -*-
 @deftypefn {} {[@var{img}, @var{map}, @var{alpha}] =} __magick_read__ (@var{fname}, @var{options})
@@ -954,12 +952,8 @@
 %!assert (1)
 */
 
-OCTAVE_NAMESPACE_END
-
 #if defined (HAVE_MAGICK)
 
-OCTAVE_NAMESPACE_BEGIN
-
 template <typename T>
 static uint32NDArray
 img_float2uint (const T& img)
@@ -1485,12 +1479,8 @@
     }
 }
 
-OCTAVE_NAMESPACE_END
-
 #endif
 
-OCTAVE_NAMESPACE_BEGIN
-
 DEFUN (__magick_write__, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {} __magick_write__ (@var{fname}, @var{fmt}, @var{img}, @var{map}, @var{options})
@@ -1745,12 +1735,8 @@
 #endif
 }
 
-OCTAVE_NAMESPACE_END
-
 #if defined (HAVE_MAGICK)
 
-OCTAVE_NAMESPACE_BEGIN
-
 static octave_value
 magick_to_octave_value (const Magick::CompressionType& magick)
 {
@@ -1915,12 +1901,8 @@
   return;
 }
 
-OCTAVE_NAMESPACE_END
-
 #endif
 
-OCTAVE_NAMESPACE_BEGIN
-
 DEFUN (__magick_finfo__, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {} __magick_finfo__ (@var{fname})
--- a/libinterp/dldfcn/__delaunayn__.cc	Sun Aug 15 15:15:55 2021 -0400
+++ b/libinterp/dldfcn/__delaunayn__.cc	Sun Aug 15 16:57:52 2021 -0400
@@ -62,15 +62,16 @@
 #include "ovl.h"
 
 #if defined (HAVE_QHULL)
-
 #  include "oct-qhull.h"
-
 #  if defined (NEED_QHULL_R_VERSION)
 char qh_version[] = "__delaunayn__.oct 2007-08-21";
 #  endif
+#endif
 
 OCTAVE_NAMESPACE_BEGIN
 
+#if defined (HAVE_QHULL)
+
 static void
 free_qhull_memory (qhT *qh)
 {
@@ -98,12 +99,8 @@
   return true;
 }
 
-OCTAVE_NAMESPACE_END
-
 #endif
 
-OCTAVE_NAMESPACE_BEGIN
-
 DEFUN_DLD (__delaunayn__, args, ,
            doc: /* -*- texinfo -*-
 @deftypefn  {} {@var{T} =} __delaunayn__ (@var{pts})
--- a/libinterp/dldfcn/__ode15__.cc	Sun Aug 15 15:15:55 2021 -0400
+++ b/libinterp/dldfcn/__ode15__.cc	Sun Aug 15 16:57:52 2021 -0400
@@ -80,8 +80,12 @@
 #    include <sunlinsol/sunlinsol_klu.h>
 #  endif
 
+#endif
+
 OCTAVE_NAMESPACE_BEGIN
 
+#if defined (HAVE_SUNDIALS)
+
 #  if ! defined (HAVE_IDASETJACFN) && defined (HAVE_IDADLSSETJACFN)
   static inline int
   IDASetJacFn (void *ida_mem, IDADlsJacFn jac)
@@ -1243,12 +1247,8 @@
     return retval;
   }
 
-OCTAVE_NAMESPACE_END
-
 #endif
 
-OCTAVE_NAMESPACE_BEGIN
-
 DEFUN_DLD (__ode15__, args, ,
            doc: /* -*- texinfo -*-
 @deftypefn {} {@var{t}, @var{y} =} __ode15__ (@var{fun}, @var{tspan}, @var{y0}, @var{yp0}, @var{options}, @var{num_event_args})
--- a/libinterp/dldfcn/__voronoi__.cc	Sun Aug 15 15:15:55 2021 -0400
+++ b/libinterp/dldfcn/__voronoi__.cc	Sun Aug 15 16:57:52 2021 -0400
@@ -57,15 +57,16 @@
 #include "ovl.h"
 
 #if defined (HAVE_QHULL)
-
 #  include "oct-qhull.h"
-
 #  if defined (NEED_QHULL_R_VERSION)
 char qh_version[] = "__voronoi__.oct 2007-07-24";
 #  endif
+#endif
 
 OCTAVE_NAMESPACE_BEGIN
 
+#if defined (HAVE_QHULL)
+
 static void
 free_qhull_memory (qhT *qh)
 {
@@ -93,12 +94,8 @@
   return true;
 }
 
-OCTAVE_NAMESPACE_END
-
 #endif
 
-OCTAVE_NAMESPACE_BEGIN
-
 DEFUN_DLD (__voronoi__, args, ,
            doc: /* -*- texinfo -*-
 @deftypefn  {} {@var{C}, @var{F} =} __voronoi__ (@var{caller}, @var{pts})