usermem_r.c
Go to the documentation of this file.
1 /*<html><pre> -<a href="qh-user_r.htm"
2  >-------------------------------</a><a name="TOP">-</a>
3 
4  usermem_r.c
5  qh_exit(), qh_free(), and qh_malloc()
6 
7  See README.txt.
8 
9  If you redefine one of these functions you must redefine all of them.
10  If you recompile and load this file, then usermem.o will not be loaded
11  from qhull.a or qhull.lib
12 
13  See libqhull_r.h for data structures, macros, and user-callable functions.
14  See user_r.c for qhull-related, redefinable functions
15  see user_r.h for user-definable constants
16  See userprintf_r.c for qh_fprintf and userprintf_rbox_r.c for qh_fprintf_rbox
17 
18  Please report any errors that you fix to qhull@qhull.org
19 */
20 
21 #include "libqhull_r.h"
22 
23 #include <stdarg.h>
24 #include <stdlib.h>
25 
26 /*-<a href="qh-user_r.htm#TOC"
27  >-------------------------------</a><a name="qh_exit">-</a>
28 
29  qh_exit( exitcode )
30  exit program
31 
32  notes:
33  qh_exit() is called when qh_errexit() and longjmp() are not available.
34 
35  This is the only use of exit() in Qhull
36  To replace qh_exit with 'throw', see libqhullcpp/usermem_r-cpp.cpp
37 */
38 void qh_exit(int exitcode) {
39  exit(exitcode);
40 } /* exit */
41 
42 /*-<a href="qh-user_r.htm#TOC"
43  >-------------------------------</a><a name="qh_fprintf_stderr">-</a>
44 
45  qh_fprintf_stderr( msgcode, format, list of args )
46  fprintf to stderr with msgcode (non-zero)
47 
48  notes:
49  qh_fprintf_stderr() is called when qh->ferr is not defined, usually due to an initialization error
50 
51  It is typically followed by qh_errexit().
52 
53  Redefine this function to avoid using stderr
54 
55  Use qh_fprintf [userprintf_r.c] for normal printing
56 */
57 void qh_fprintf_stderr(int msgcode, const char *fmt, ... ) {
58  va_list args;
59 
60  va_start(args, fmt);
61  if(msgcode)
62  fprintf(stderr, "QH%.4d ", msgcode);
63  vfprintf(stderr, fmt, args);
64  va_end(args);
65 } /* fprintf_stderr */
66 
67 /*-<a href="qh-user_r.htm#TOC"
68 >-------------------------------</a><a name="qh_free">-</a>
69 
70  qh_free(qhT *qh, mem )
71  free memory
72 
73  notes:
74  same as free()
75  No calls to qh_errexit()
76 */
77 void qh_free(void *mem) {
78  free(mem);
79 } /* free */
80 
81 /*-<a href="qh-user_r.htm#TOC"
82  >-------------------------------</a><a name="qh_malloc">-</a>
83 
84  qh_malloc( mem )
85  allocate memory
86 
87  notes:
88  same as malloc()
89 */
90 void *qh_malloc(size_t size) {
91  return malloc(size);
92 } /* malloc */
93 
94 
obb.fmt
fmt
Definition: obb.py:145
qh_exit
void qh_exit(int exitcode)
Definition: usermem_r.c:38
qh_fprintf_stderr
void qh_fprintf_stderr(int msgcode, const char *fmt,...)
Definition: usermem_r.c:57
doxygen_xml_parser.args
args
Definition: doxygen_xml_parser.py:884
libqhull_r.h
qh_free
void qh_free(void *mem)
Definition: usermem_r.c:77
qh_malloc
void * qh_malloc(size_t size)
Definition: usermem_r.c:90


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:15