# HG changeset patch # User dbateman # Date 1189201196 0 # Node ID e00a8f661f06f359dd4a3d33417fcab0e228aa47 # Parent 28f3be713c1db9dca46c28b7929da4eedb72e60e [project @ 2007-09-07 21:39:55 by dbateman] diff -r 28f3be713c1d -r e00a8f661f06 src/ChangeLog --- a/src/ChangeLog Fri Sep 07 21:35:44 2007 +0000 +++ b/src/ChangeLog Fri Sep 07 21:39:56 2007 +0000 @@ -1,4 +1,9 @@ -2007-09-06 John W. Eaton +2007-09-06 David Bateman + + * DLD-FUNCTIONS/__delaunay__.cc, DLD-FUNCRIONS/__voronoi__.cc, + DLD-FUNCTIONS/convhulln.cc: Avoid variables in global scope + +2007-09-06 David Bateman * Makefile.in (stamp-prereq): Add graphics.h to the dependency list. diff -r 28f3be713c1d -r e00a8f661f06 src/DLD-FUNCTIONS/__delaunayn__.cc --- a/src/DLD-FUNCTIONS/__delaunayn__.cc Fri Sep 07 21:35:44 2007 +0000 +++ b/src/DLD-FUNCTIONS/__delaunayn__.cc Fri Sep 07 21:39:56 2007 +0000 @@ -56,9 +56,6 @@ #ifdef NEED_QHULL_VERSION char qh_version[] = "__delaunayn__.oct 2007-08-21"; #endif -FILE *outfile = stdout; -FILE *errfile = stderr; -char flags[250]; #endif DEFUN_DLD (__delaunayn__, args, , @@ -128,18 +125,23 @@ //octave_stdout << "options " << options << std::endl; - if (n > dim) + if (n > dim + 1) { p = p.transpose(); double *pt_array = p.fortran_vec(); boolT ismalloc = False; + OCTAVE_LOCAL_BUFFER (char, flags, 250); + sprintf(flags,"qhull d %s",options.c_str()); // If you want some debugging information replace the NULL // pointer with outfile. - int exitcode = qh_new_qhull (dim, n, pt_array, ismalloc,flags, + FILE *outfile = stdout; + FILE *errfile = stderr; + + int exitcode = qh_new_qhull (dim, n, pt_array, ismalloc, flags, NULL, errfile); if (exitcode) diff -r 28f3be713c1d -r e00a8f661f06 src/DLD-FUNCTIONS/__voronoi__.cc --- a/src/DLD-FUNCTIONS/__voronoi__.cc Fri Sep 07 21:35:44 2007 +0000 +++ b/src/DLD-FUNCTIONS/__voronoi__.cc Fri Sep 07 21:39:56 2007 +0000 @@ -46,11 +46,6 @@ #ifdef NEED_QHULL_VERSION char qh_version[] = "__voronoi__.oct 2007-07-24"; #endif - -FILE *outfile = stdout; -FILE *errfile = stderr; -char flags[250]; -const char *options; #endif DEFUN_DLD (__voronoi__, args, , @@ -71,6 +66,8 @@ return retval; } + const char *options; + if (nargin == 2) { if (!args (1).is_string ()) @@ -101,8 +98,16 @@ boolT ismalloc = false; + OCTAVE_LOCAL_BUFFER(char, flags, 250); + // hmm lot's of options for qhull here sprintf(flags,"qhull v Fv T0 %s",options); + + // If you want some debugging information replace the NULL + // pointer with outfile. + FILE *outfile = stdout; + FILE *errfile = stderr; + if (!qh_new_qhull (dim, np, pt_array, ismalloc, flags, NULL, errfile)) { diff -r 28f3be713c1d -r e00a8f661f06 src/DLD-FUNCTIONS/convhulln.cc --- a/src/DLD-FUNCTIONS/convhulln.cc Fri Sep 07 21:35:44 2007 +0000 +++ b/src/DLD-FUNCTIONS/convhulln.cc Fri Sep 07 21:39:56 2007 +0000 @@ -50,7 +50,6 @@ #ifdef NEED_QHULL_VERSION char qh_version[] = "convhulln.oct 2007-07-24"; #endif -char flags[250]; #endif DEFUN_DLD (convhulln, args, , @@ -116,6 +115,8 @@ boolT ismalloc = False; + OCTAVE_LOCAL_BUFFER (char, flags, 250); + // hmm, lots of options for qhull here // QJ guarantees that the output will be triangles snprintf(flags, sizeof(flags), "qhull QJ %s", options.c_str());