[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of li
From: |
Stefan Brüns |
Subject: |
[Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r |
Date: |
Fri, 7 May 2021 12:49:53 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0 |
Follow-up Comment #20, bug #60016 (project octave):
[comment #18 comment #18:]
> It's not clear that we need to initialize the variable "context" of type
qhT. The Qhull website has an example of using the re-entrant library. The
code is at http://www.qhull.org/src/qhull/unix_r.c.
>
> Quoting from that code,
>
>
> int main(int argc, char *argv[]) {
> int curlong, totlong; /* used !qh_NOmem */
> int exitcode, numpoints, dim;
> coordT *points;
> boolT ismalloc;
> qhT qh_qh;
> qhT *qh= &qh_qh;
>
> QHULL_LIB_CHECK /* Check for compatible library */
>
You omit the relevant part of code later, which *does* initialize qh_qh.
> Our equivalent code is
>
>
> + qhT context = { 0 };
> + qhT *qh = &context;
>
>
> I'd just drop the initialization "{ 0 }".
Nope. Definitely breaks qhull when you are unlucky and some fields are not
0-initialized.
Run the following through valgrind:
#include <string>
#include <iostream>
#include <libqhull_r/libqhull_r.h>
#include <libqhull_r/geom_r.h>
int main(int argc, char* argv[])
{
qhT context; // not initialized = { 0 };
qhT* qh = &context;
int numpoints = 4;
coordT points[] = {0,0,0, 1,0,0, 0,1,0, 0,0,1};
int dim = 3;
bool ismalloc = false;
std::string cmd = "qhull s FA";
FILE* outfile = fopen("/dev/stdout", "w+");
FILE* errfile = fopen("/dev/stderr", "w+");
qh_new_qhull (qh, dim, numpoints, points,
ismalloc, &cmd[0], outfile, errfile);
qh_getarea(qh, qh->facet_list);
std::cout << qh->totvol << std::endl;
std::cout << qh->totarea << std::endl;
qh_freeqhull (qh, !qh_ALL);
}
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60016>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Markus Mützel, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Rik, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Stefan Brüns, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r,
Stefan Brüns <=
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Rik, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Markus Mützel, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Markus Mützel, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Mike Miller, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Rik, 2021/05/07
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Markus Mützel, 2021/05/08
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Rik, 2021/05/08
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Mike Miller, 2021/05/08
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Markus Mützel, 2021/05/08
- [Octave-bug-tracker] [bug #60016] libqhull was deprecated in favor of libqhull_r, Rik, 2021/05/09