summaryrefslogtreecommitdiff
path: root/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc
diff options
context:
space:
mode:
authorThierry Thomas <thierry@FreeBSD.org>2022-02-18 19:36:53 +0100
committerThierry Thomas <thierry@FreeBSD.org>2022-02-18 19:44:54 +0100
commitf1ef83b857f555f0c7a6182ca02002b63cfe80f9 (patch)
tree0325223506bc4be5a1a095f7964e9bccf597a7cd /math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc
parentmath/plplot: switch to Qhull8 (diff)
math/octave: switch to Qhull8
Patch obtained from https://savannah.gnu.org/bugs/download.php?file_id=51705 PR: 261281 Approved by: stephen (maintainer)
Diffstat (limited to 'math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc')
-rw-r--r--math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc73
1 files changed, 73 insertions, 0 deletions
diff --git a/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc b/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc
new file mode 100644
index 000000000000..973f01f0de83
--- /dev/null
+++ b/math/octave/files/patch-libinterp_dldfcn_____delaunayn____.cc
@@ -0,0 +1,73 @@
+--- libinterp/dldfcn/__delaunayn__.cc.orig 2021-10-30 14:20:24 UTC
++++ libinterp/dldfcn/__delaunayn__.cc
+@@ -65,7 +65,7 @@
+
+ # include "oct-qhull.h"
+
+-# if defined (NEED_QHULL_VERSION)
++# if defined (NEED_QHULL_R_VERSION)
+ char qh_version[] = "__delaunayn__.oct 2007-08-21";
+ # endif
+
+@@ -76,12 +76,12 @@ close_fcn (FILE *f)
+ }
+
+ static void
+-free_qhull_memory ()
++free_qhull_memory (qhT *qh)
+ {
+- qh_freeqhull (! qh_ALL);
++ qh_freeqhull (qh, ! qh_ALL);
+
+ int curlong, totlong;
+- qh_memfreeshort (&curlong, &totlong);
++ qh_memfreeshort (qh, &curlong, &totlong);
+
+ if (curlong || totlong)
+ warning ("__delaunayn__: did not free %d bytes of long memory (%d pieces)",
+@@ -161,11 +161,8 @@ Undocumented internal function.
+ double *pt_array = p.fortran_vec ();
+ boolT ismalloc = false;
+
+- // Qhull flags argument is not const char*
+- OCTAVE_LOCAL_BUFFER (char, flags, 9 + options.length ());
++ std::string cmd = "qhull d " + options;
+
+- sprintf (flags, "qhull d %s", options.c_str ());
+-
+ octave::unwind_protect frame;
+
+ // Replace the outfile pointer with stdout for debugging information.
+@@ -181,16 +178,19 @@ Undocumented internal function.
+
+ frame.add_fcn (close_fcn, outfile);
+
+- int exitcode = qh_new_qhull (dim, n, pt_array,
+- ismalloc, flags, outfile, errfile);
++ qhT context = { 0 };
++ qhT *qh = &context;
+
+- frame.add_fcn (free_qhull_memory);
++ int exitcode = qh_new_qhull (qh, dim, n, pt_array, ismalloc, &cmd[0],
++ outfile, errfile);
+
++ octave::unwind_action free_memory ([qh] () { free_qhull_memory (qh); });
++
+ if (exitcode)
+ error ("__delaunayn__: qhull failed");
+
+ // triangulate non-simplicial facets
+- qh_triangulate ();
++ qh_triangulate (qh);
+
+ facetT *facet;
+ vertexT *vertex, **vertexp;
+@@ -217,7 +217,7 @@ Undocumented internal function.
+
+ FOREACHvertex_ (facet->vertices)
+ {
+- simpl(i, j++) = 1 + qh_pointid(vertex->point);
++ simpl(i, j++) = 1 + qh_pointid(qh, vertex->point);
+ }
+ i++;
+ }