Mercurial > hg > th-libs
annotate th_util.c @ 469:fe5b803ae449
Rename the global variable th_verbosityLevel to th_verbosity.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 04 Jun 2018 02:41:27 +0300 |
parents | bbe3c9175d77 |
children | 167b66942c24 |
rev | line source |
---|---|
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 /* |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 * Generic utility-functions, macros and defaults |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 * Programmed and designed by Matti 'ccr' Hamalainen |
144 | 4 * (C) Copyright 2002-2015 Tecnic Software productions (TNSP) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 * |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 * Please read file 'COPYING' for information on license and distribution. |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 */ |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 #include "th_util.h" |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
96 | 10 #include <errno.h> |
11 | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 |
4
67f4a4233372
Move defaults to header file.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
13 /* Default settings |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 */ |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
15 static BOOL th_initialized = FALSE; |
469
fe5b803ae449
Rename the global variable th_verbosityLevel to th_verbosity.
Matti Hamalainen <ccr@tnsp.org>
parents:
468
diff
changeset
|
16 int th_verbosity = 2; |
60 | 17 char *th_prog_name = NULL, |
18 *th_prog_desc = NULL, | |
19 *th_prog_version = NULL, | |
20 *th_prog_author = NULL, | |
21 *th_prog_license = NULL; | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 /* Initialize th_util-library and global variables |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 */ |
60 | 26 void th_init(char *name, char *desc, char *version, |
27 char *author, char *license) | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
28 { |
60 | 29 th_prog_name = name; |
30 th_prog_desc = desc; | |
31 th_prog_version = version; | |
468
bbe3c9175d77
Do not set default author/copyright anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
467
diff
changeset
|
32 th_prog_author = author; |
bbe3c9175d77
Do not set default author/copyright anymore.
Matti Hamalainen <ccr@tnsp.org>
parents:
467
diff
changeset
|
33 th_prog_license = license; |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
35 th_initialized = TRUE; |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 |
64 | 39 void th_print_banner(FILE *outFile, const char *name, const char *usage) |
45
e031a062b731
Separate program "banner" printing from th_args_help() to th_print_banner().
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
40 { |
177
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
41 fprintf(outFile, "\n%s", th_prog_name); |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
42 if (th_prog_version != NULL) |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
43 fprintf(outFile, " v%s", th_prog_version); |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
44 if (th_prog_desc != NULL) |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
45 fprintf(outFile, " (%s)", th_prog_desc); |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
46 fprintf(outFile, "\n"); |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
47 |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
48 if (th_prog_author != NULL) |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
49 fprintf(outFile, "%s\n", th_prog_author); |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
50 |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
51 if (th_prog_license != NULL) |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
52 fprintf(outFile, "%s\n", th_prog_license); |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
53 |
2b07e452fd78
Adjust program banner printing.
Matti Hamalainen <ccr@tnsp.org>
parents:
162
diff
changeset
|
54 fprintf(outFile, "Usage: %s %s\n", name, usage); |
45
e031a062b731
Separate program "banner" printing from th_args_help() to th_print_banner().
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
55 } |
e031a062b731
Separate program "banner" printing from th_args_help() to th_print_banner().
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
56 |
e031a062b731
Separate program "banner" printing from th_args_help() to th_print_banner().
Matti Hamalainen <ccr@tnsp.org>
parents:
40
diff
changeset
|
57 |
143 | 58 int th_term_width() |
59 { | |
60 char *var = getenv("COLUMNS"); | |
61 int res = (var != NULL) ? atoi(var) : 80; | |
62 if (res < 5) res = 80; | |
63 return res; | |
64 } | |
65 | |
66 | |
67 int th_term_height() | |
68 { | |
467
b92b18500bf9
Oops. We've been trying to get number of terminal lines from environment
Matti Hamalainen <ccr@tnsp.org>
parents:
462
diff
changeset
|
69 char *var = getenv("LINES"); |
143 | 70 int res = (var != NULL) ? atoi(var) : 25; |
71 if (res < 1) res = 1; | |
72 return res; | |
73 } | |
74 | |
75 | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
76 /* Print formatted error, warning and information messages |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 * TODO: Implement th_vfprintf() and friends? |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
78 */ |
11 | 79 void THERR_V(const char *fmt, va_list ap) |
80 { | |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
81 assert(th_initialized == TRUE); |
11 | 82 |
83 fprintf(stderr, "%s: ", th_prog_name); | |
84 vfprintf(stderr, fmt, ap); | |
85 } | |
86 | |
87 | |
88 void THMSG_V(int level, const char *fmt, va_list ap) | |
89 { | |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
90 assert(th_initialized == TRUE); |
11 | 91 |
469
fe5b803ae449
Rename the global variable th_verbosityLevel to th_verbosity.
Matti Hamalainen <ccr@tnsp.org>
parents:
468
diff
changeset
|
92 if (th_verbosity >= level) |
48 | 93 { |
11 | 94 fprintf(stderr, "%s: ", th_prog_name); |
95 vfprintf(stderr, fmt, ap); | |
96 } | |
97 } | |
98 | |
99 | |
100 void THPRINT_V(int level, const char *fmt, va_list ap) | |
101 { | |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
102 assert(th_initialized == TRUE); |
11 | 103 |
469
fe5b803ae449
Rename the global variable th_verbosityLevel to th_verbosity.
Matti Hamalainen <ccr@tnsp.org>
parents:
468
diff
changeset
|
104 if (th_verbosity >= level) |
48 | 105 { |
11 | 106 vfprintf(stderr, fmt, ap); |
107 } | |
108 } | |
109 | |
110 | |
111 void THERR(const char *fmt, ...) | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
112 { |
10 | 113 va_list ap; |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
114 assert(th_initialized == TRUE); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
115 |
11 | 116 va_start(ap, fmt); |
117 THERR_V(fmt, ap); | |
10 | 118 va_end(ap); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 |
11 | 122 void THMSG(int level, const char *fmt, ...) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
123 { |
10 | 124 va_list ap; |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
125 assert(th_initialized == TRUE); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 |
11 | 127 va_start(ap, fmt); |
128 THMSG_V(level, fmt, ap); | |
129 va_end(ap); | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
130 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
131 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 |
11 | 133 void THPRINT(int level, const char *fmt, ...) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
134 { |
10 | 135 va_list ap; |
457
85fa3d333556
Actually, revert the boolean changes .. meh.
Matti Hamalainen <ccr@tnsp.org>
parents:
453
diff
changeset
|
136 assert(th_initialized == TRUE); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
137 |
11 | 138 va_start(ap, fmt); |
139 THPRINT_V(level, fmt, ap); | |
140 va_end(ap); | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
141 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
142 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
143 |
96 | 144 /* Error handling |
145 */ | |
101
a8f732601fdc
Rename th_get_errno() to th_get_error(), it's more appropriate since it does
Matti Hamalainen <ccr@tnsp.org>
parents:
99
diff
changeset
|
146 int th_get_error() |
96 | 147 { |
148 return TH_SYSTEM_ERRORS + errno; | |
149 } | |
150 | |
151 | |
99 | 152 int th_errno_to_error(int error) |
153 { | |
154 return TH_SYSTEM_ERRORS + error; | |
155 } | |
156 | |
157 | |
96 | 158 const char *th_error_str(int error) |
159 { | |
160 if (error >= TH_SYSTEM_ERRORS) | |
161 return strerror(error - TH_SYSTEM_ERRORS); | |
441
2991e6b52d95
Get rid of trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
269
diff
changeset
|
162 |
96 | 163 switch (error) |
164 { | |
165 case THERR_OK: return "No error"; | |
166 case THERR_FOPEN: return "File open error"; | |
167 case THERR_FREAD: return "Read error"; | |
168 case THERR_FWRITE: return "Write error"; | |
169 case THERR_FSEEK: return "Seek error"; | |
170 case THERR_NOT_FOUND: return "Resource not found"; | |
171 | |
172 case THERR_INVALID_DATA: return "Invalid data"; | |
173 case THERR_MALLOC: return "Memory allocation failure"; | |
174 case THERR_ALREADY_INIT: return "Already initialized"; | |
175 case THERR_INIT_FAIL: return "Initialization failed"; | |
176 case THERR_INVALID_ARGS: return "Invalid arguments"; | |
177 | |
178 case THERR_NULLPTR: return "NULL pointer"; | |
179 case THERR_NOT_SUPPORTED: return "Operation not supported"; | |
180 case THERR_OUT_OF_DATA: return "Out of data"; | |
181 case THERR_EXTRA_DATA: return "Extra data"; | |
182 case THERR_BOUNDS: return "Bounds check failed"; | |
183 | |
184 case THERR_TIMED_OUT: return "Operation timed out"; | |
441
2991e6b52d95
Get rid of trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
269
diff
changeset
|
185 |
96 | 186 case THERR_AUTH_FAILED: return "Authentication failed"; |
187 | |
188 default: return "Unknown error"; | |
189 } | |
190 } | |
191 | |
192 | |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
193 /* Memory handling routines |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
194 */ |
462 | 195 void *th_malloc(size_t len) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
196 { |
462 | 197 return malloc(len); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
198 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
199 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
200 |
462 | 201 void *th_malloc0(size_t len) |
68
29f9651465c6
Added a new memory allocator function, th_malloc0(size), which is the same as calloc(1, size).
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
202 { |
462 | 203 return calloc(1, len); |
68
29f9651465c6
Added a new memory allocator function, th_malloc0(size), which is the same as calloc(1, size).
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
204 } |
29f9651465c6
Added a new memory allocator function, th_malloc0(size), which is the same as calloc(1, size).
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
205 |
29f9651465c6
Added a new memory allocator function, th_malloc0(size), which is the same as calloc(1, size).
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
206 |
462 | 207 void *th_calloc(size_t n, size_t len) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
208 { |
462 | 209 return calloc(n, len); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
210 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
211 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
212 |
462 | 213 void *th_realloc(void *ptr, size_t len) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
214 { |
462 | 215 return realloc(ptr, len); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
216 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
217 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
218 |
194
87dac812cac4
Define some argument identifiers in function prototypes and rename some arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
219 void th_free(void *ptr) |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
220 { |
10 | 221 /* Check for NULL pointers for portability due to some libc |
222 * implementations not handling free(NULL) too well. | |
223 */ | |
194
87dac812cac4
Define some argument identifiers in function prototypes and rename some arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
224 if (ptr != NULL) free(ptr); |
0
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
225 } |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
226 |
bd61a80a6c54
Initial import into Mercurial repository. Discarding old cvs/svn history
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
227 |
197
88986d0b56ef
Rename th_free_r() to th_free_r_real() and #define a macro wrapper for
Matti Hamalainen <ccr@tnsp.org>
parents:
195
diff
changeset
|
228 void th_free_r_real(void **ptr) |
192
7d25d43a3ce2
Add new function th_free_r(void **ptr) that calls th_free(*ptr) and sets *ptr to NULL.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
229 { |
195 | 230 if (ptr != NULL) |
192
7d25d43a3ce2
Add new function th_free_r(void **ptr) that calls th_free(*ptr) and sets *ptr to NULL.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
231 { |
194
87dac812cac4
Define some argument identifiers in function prototypes and rename some arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
232 th_free(*ptr); |
87dac812cac4
Define some argument identifiers in function prototypes and rename some arguments.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
233 *ptr = NULL; |
192
7d25d43a3ce2
Add new function th_free_r(void **ptr) that calls th_free(*ptr) and sets *ptr to NULL.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
234 } |
7d25d43a3ce2
Add new function th_free_r(void **ptr) that calls th_free(*ptr) and sets *ptr to NULL.
Matti Hamalainen <ccr@tnsp.org>
parents:
177
diff
changeset
|
235 } |