Mercurial > libpst
annotate src/debug.c @ 180:265c7a65b75b
switch back to fully versioned subpackage dependencies
add doxygen devel-doc documentation for the shared library
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 10 Apr 2009 12:00:46 -0700 |
parents | ac6e22c8a9cf |
children | 2f38c4ce606f |
rev | line source |
---|---|
48 | 1 #include "define.h" |
16 | 2 |
46 | 3 struct pst_debug_item { |
4 int type; | |
5 char * function; | |
6 unsigned int line; | |
7 char * file; | |
8 char * text; | |
9 struct pst_debug_item *next; | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
10 }; |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
11 |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
12 static struct pst_debug_item *item_head=NULL, *item_tail=NULL, *item_ptr=NULL, *info_ptr=NULL, *temp_list=NULL; |
16 | 13 |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
14 |
46 | 15 struct pst_debug_func { |
16 char * name; | |
17 struct pst_debug_func *next; | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
18 }; |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
19 |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
20 static struct pst_debug_func *func_head=NULL, *func_ptr=NULL; |
16 | 21 |
22 | |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
23 static void pst_debug_write_msg(struct pst_debug_item *item, const char *fmt, va_list *ap, int size); |
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
24 static void pst_debug_write_hex(struct pst_debug_item *item, char *buf, size_t size, int col); |
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
25 static void pst_debug_write(); |
16 | 26 |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
27 |
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
28 static size_t pst_debug_fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); |
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
29 static size_t pst_debug_fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream) { |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
30 return fwrite(ptr, size, nitems, stream); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
31 } |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
32 |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
33 |
16 | 34 // the largest text size we will store in memory. Otherwise we |
35 // will do a debug_write, then create a new record, and write the | |
36 // text body directly to the file | |
37 #define MAX_MESSAGE_SIZE 4096 | |
38 | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
39 void pst_debug(const char *fmt, ...) { |
46 | 40 va_list ap; |
41 va_start(ap,fmt); | |
42 vfprintf(stderr, fmt, ap); | |
43 va_end(ap); | |
16 | 44 } |
45 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
46 |
16 | 47 #define NUM_COL 30 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
48 void pst_debug_hexdumper(FILE *out, char *buf, size_t size, int col, int delta) { |
70
b12f4e50e2e8
Patch from Joachim Metz <joachim.metz@gmail.com> for 64 bit compile.
Carl Byington <carl@five-ten-sg.com>
parents:
48
diff
changeset
|
49 size_t off = 0, toff; |
46 | 50 int count = 0; |
16 | 51 |
46 | 52 if (!out) return; // no file |
53 if (col == -1) col = NUM_COL; | |
54 fprintf(out, "\n"); | |
55 while (off < size) { | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
56 fprintf(out, "%06"PRIx64"\t:", (int64_t)(off+delta)); |
46 | 57 toff = off; |
58 while (count < col && off < size) { | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
59 fprintf(out, "%02hhx ", (unsigned char)buf[off]); |
46 | 60 off++; count++; |
61 } | |
62 off = toff; | |
63 while (count < col) { | |
64 // only happens at end of block to pad the text over to the text column | |
65 fprintf(out, " "); | |
66 count++; | |
67 } | |
68 count = 0; | |
69 fprintf(out, ":"); | |
70 while (count < col && off < size) { | |
71 fprintf(out, "%c", isgraph(buf[off])?buf[off]:'.'); | |
72 off++; count ++; | |
73 } | |
16 | 74 |
46 | 75 fprintf(out, "\n"); |
76 count=0; | |
77 } | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
78 |
46 | 79 fprintf(out, "\n"); |
16 | 80 } |
81 | |
82 | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
83 static FILE *debug_fp = NULL; |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
84 static unsigned int max_items=DEBUG_MAX_ITEMS, curr_items=0; |
16 | 85 |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
86 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
87 void pst_debug_init(const char* fname) { |
46 | 88 unsigned char version = DEBUG_VERSION; |
89 item_head = item_tail = NULL; | |
90 curr_items = 0; | |
91 if (debug_fp) pst_debug_close(); | |
92 if (!fname) return; | |
93 if ((debug_fp = fopen(fname, "wb")) == NULL) { | |
94 fprintf(stderr, "Opening of file %s failed\n", fname); | |
95 exit(1); | |
96 } | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
97 pst_debug_fwrite(&version, sizeof(char), 1, debug_fp); |
16 | 98 } |
99 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
100 |
46 | 101 // function must be called before pst_debug_msg. It sets up the |
16 | 102 // structure for the function that follows |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
103 void pst_debug_msg_info(int line, const char* file, int type) { |
46 | 104 char *x; |
105 if (!debug_fp) return; // no file | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
106 info_ptr = (struct pst_debug_item*) pst_malloc(sizeof(struct pst_debug_item)); |
46 | 107 info_ptr->type = type; |
108 info_ptr->line = line; | |
109 x = (func_head==NULL?"No Function":func_head->name); | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
110 info_ptr->function = (char*) pst_malloc(strlen(x)+1); |
46 | 111 strcpy(info_ptr->function, x); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
112 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
113 info_ptr->file = (char*) pst_malloc(strlen(file)+1); |
46 | 114 strcpy(info_ptr->file, file); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
115 |
46 | 116 //put the current record on a temp linked list |
117 info_ptr->next = temp_list; | |
118 temp_list = info_ptr; | |
16 | 119 } |
120 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
121 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
122 void pst_debug_msg_text(const char* fmt, ...) { |
46 | 123 va_list ap; |
124 int f, g; | |
125 char x[2]; | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
126 #ifdef _WIN32 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
127 char *buf = NULL; |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
128 #endif |
46 | 129 struct pst_debug_item *temp; |
130 if (!debug_fp) return; // no file | |
131 // get the record off of the temp_list | |
132 info_ptr = temp_list; | |
133 if (info_ptr) | |
134 temp_list = info_ptr->next; | |
135 else { | |
136 fprintf(stderr, "NULL info_ptr. ERROR!!\n"); | |
137 exit(-2); | |
138 } | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
139 |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
140 #ifdef _WIN32 |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
141 // vsnprintf trick doesn't work on msvc. |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
142 g = 2000; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
143 f = -1; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
144 while (f < 0) { |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
145 buf = realloc(buf, g+1); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
146 va_start(ap, fmt); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
147 f = vsnprintf(buf, g, fmt, ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
148 va_end(ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
149 g += g/2; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
150 } |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
151 free(buf); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
152 #else |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
153 // according to glibc 2.1, this should return the req. number of bytes for |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
154 // the string |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
155 va_start(ap, fmt); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
156 f = vsnprintf(x, 1, fmt, ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
157 va_end(ap); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
158 #endif |
16 | 159 |
46 | 160 if (f > 0 && f < MAX_MESSAGE_SIZE) { |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
161 info_ptr->text = (char*) pst_malloc(f+1); |
46 | 162 va_start(ap, fmt); |
163 if ((g = vsnprintf(info_ptr->text, f, fmt, ap)) == -1) { | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
164 fprintf(stderr, "_debug_msg: Dying! vsnprintf returned -1 for format \"%s\"\n", fmt); |
46 | 165 exit(-2); |
166 } | |
167 va_end(ap); | |
168 info_ptr->text[g] = '\0'; | |
169 if (f != g) { | |
170 fprintf(stderr, "_debug_msg: f != g\n"); | |
171 } | |
172 } else if (f > 0) { // it is over the max_message_size then | |
173 f += strlen(info_ptr->file)+strlen(info_ptr->function); | |
174 temp = info_ptr; | |
175 pst_debug_write(); // dump the current messages | |
176 info_ptr = temp; | |
177 va_start(ap, fmt); | |
178 pst_debug_write_msg(info_ptr, fmt, &ap, f); | |
179 va_end(ap); | |
180 free(info_ptr->function); | |
181 free(info_ptr->file); | |
182 free(info_ptr); | |
183 info_ptr = NULL; | |
184 return; | |
185 } else { | |
186 fprintf(stderr, "_debug_msg: error getting requested size of debug message\n"); | |
187 info_ptr->text = "ERROR Saving\n"; | |
188 } | |
16 | 189 |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
190 // add to the linked list of pending items |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
191 if (!item_head) item_head = info_ptr; |
46 | 192 info_ptr->next = NULL; |
193 if (item_tail) item_tail->next = info_ptr; | |
194 item_tail = info_ptr; | |
16 | 195 |
46 | 196 if (++curr_items == max_items) { |
197 // here we will jump off and save the contents | |
198 pst_debug_write(); | |
199 info_ptr = NULL; | |
200 } | |
16 | 201 } |
202 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
203 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
204 void pst_debug_hexdump(char *x, size_t y, int cols, int delta) { |
46 | 205 struct pst_debug_item *temp; |
206 if (!debug_fp) return; // no file | |
207 info_ptr = temp_list; | |
208 if (info_ptr) temp_list = info_ptr->next; | |
209 temp = info_ptr; | |
210 pst_debug_write(); | |
211 info_ptr = temp; | |
212 pst_debug_write_hex(info_ptr, x, y, cols); | |
213 free(info_ptr->function); | |
214 free(info_ptr->file); | |
215 free(info_ptr); | |
216 info_ptr = NULL; | |
16 | 217 } |
218 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
219 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
220 void pst_debug_func(const char *function) { |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
221 func_ptr = pst_malloc (sizeof(struct pst_debug_func)); |
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
222 func_ptr->name = pst_malloc(strlen(function)+1); |
46 | 223 strcpy(func_ptr->name, function); |
224 func_ptr->next = func_head; | |
225 func_head = func_ptr; | |
16 | 226 } |
227 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
228 |
46 | 229 void pst_debug_func_ret() { |
230 //remove the head item | |
231 func_ptr = func_head; | |
232 if (func_head) { | |
233 func_head = func_head->next; | |
234 free(func_ptr->name); | |
235 free(func_ptr); | |
236 } else { | |
237 DIE(("function list is empty!\n")); | |
238 } | |
16 | 239 } |
240 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
241 |
46 | 242 void pst_debug_close(void) { |
243 pst_debug_write(); | |
244 while (func_head) { | |
245 func_ptr = func_head; | |
246 func_head = func_head->next; | |
247 free(func_ptr->name); | |
248 free(func_ptr); | |
249 } | |
250 if (debug_fp) fclose(debug_fp); | |
251 debug_fp = NULL; | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
252 } |
16 | 253 |
254 | |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
255 static void pst_debug_write() { |
46 | 256 size_t size, ptr, funcname, filename, text, end; |
257 char *buf = NULL, rec_type; | |
258 if (!debug_fp) return; // no file | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
259 int64_t index_pos = ftello(debug_fp); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
260 int64_t file_pos = index_pos; |
46 | 261 // add 2. One for the pointer to the next index, |
262 // one for the count of this index | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
263 int index_size = ((curr_items+2) * sizeof(int64_t)); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
264 int64_t *index; |
46 | 265 int index_ptr = 0; |
266 struct pst_debug_file_rec_m mfile_rec; | |
267 struct pst_debug_file_rec_l lfile_rec; | |
16 | 268 |
46 | 269 if (curr_items == 0) return; // no items to write. |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
270 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
271 index = (int64_t*)pst_malloc(index_size); |
46 | 272 memset(index, 0, index_size); // valgrind, avoid writing uninitialized data |
273 file_pos += index_size; | |
274 // write the index first, we will re-write it later, but | |
275 // we want to allocate the space | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
276 pst_debug_fwrite(index, index_size, 1, debug_fp); |
46 | 277 index[index_ptr++] = curr_items; |
16 | 278 |
46 | 279 item_ptr = item_head; |
280 while (item_ptr) { | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
281 file_pos = ftello(debug_fp); |
46 | 282 index[index_ptr++] = file_pos; |
283 size = strlen(item_ptr->function) + | |
284 strlen(item_ptr->file) + | |
285 strlen(item_ptr->text) + 3; //for the three \0s | |
286 if (buf) free(buf); | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
287 buf = pst_malloc(size+1); |
46 | 288 ptr = 0; |
289 funcname=ptr; | |
290 ptr += sprintf(&(buf[ptr]), "%s", item_ptr->function)+1; | |
291 filename=ptr; | |
292 ptr += sprintf(&(buf[ptr]), "%s", item_ptr->file)+1; | |
293 text=ptr; | |
294 ptr += sprintf(&(buf[ptr]), "%s", item_ptr->text)+1; | |
295 end=ptr; | |
296 if (end > USHRT_MAX) { // bigger than can be stored in a short | |
297 rec_type = 'L'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
298 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
299 lfile_rec.type = item_ptr->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
300 lfile_rec.line = item_ptr->line; |
46 | 301 lfile_rec.funcname = funcname; |
302 lfile_rec.filename = filename; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
303 lfile_rec.text = text; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
304 lfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
305 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
46 | 306 } else { |
307 rec_type = 'M'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
308 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
309 mfile_rec.type = item_ptr->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
310 mfile_rec.line = item_ptr->line; |
46 | 311 mfile_rec.funcname = funcname; |
312 mfile_rec.filename = filename; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
313 mfile_rec.text = text; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
314 mfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
315 pst_debug_fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp); |
46 | 316 } |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
317 pst_debug_fwrite(buf, ptr, 1, debug_fp); |
46 | 318 if (buf) free(buf); buf = NULL; |
319 item_head = item_ptr->next; | |
320 free(item_ptr->function); | |
321 free(item_ptr->file); | |
322 free(item_ptr->text); | |
323 free(item_ptr); | |
324 item_ptr = item_head; | |
325 } | |
326 curr_items = 0; | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
327 index[index_ptr] = ftello(debug_fp); |
16 | 328 |
46 | 329 // we should now have a complete index |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
330 fseeko(debug_fp, index_pos, SEEK_SET); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
331 pst_debug_fwrite(index, index_size, 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
332 fseeko(debug_fp, 0, SEEK_END); |
46 | 333 item_ptr = item_head = item_tail = NULL; |
334 free(index); | |
335 if (buf) free(buf); | |
16 | 336 } |
337 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
338 |
176
ac6e22c8a9cf
build separate libpst, libpst-libs, libpst-devel rpms.
Carl Byington <carl@five-ten-sg.com>
parents:
172
diff
changeset
|
339 static void pst_debug_write_msg(struct pst_debug_item *item, const char *fmt, va_list *ap, int size) { |
46 | 340 struct pst_debug_file_rec_l lfile_rec; |
341 struct pst_debug_file_rec_m mfile_rec; | |
342 unsigned char rec_type; | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
343 int index_size = 3 * sizeof(int64_t); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
344 int64_t index[3]; |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
345 int64_t index_pos, file_pos; |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
346 char zero = '\0'; |
46 | 347 unsigned int end; |
348 if (!debug_fp) return; // no file | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
349 index[0] = 1; // only one item in this index |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
350 index[1] = 0; // valgrind, avoid writing uninitialized data |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
351 index[2] = 0; // "" |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
352 index_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
353 pst_debug_fwrite(index, index_size, 1, debug_fp); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
354 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
355 index[1] = ftello(debug_fp); |
16 | 356 |
46 | 357 if (size > USHRT_MAX) { // bigger than can be stored in a short |
358 rec_type = 'L'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
359 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
360 lfile_rec.type = item->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
361 lfile_rec.line = item->line; |
46 | 362 lfile_rec.funcname = 0; |
363 lfile_rec.filename = strlen(item->function)+1; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
364 lfile_rec.text = lfile_rec.filename+strlen(item->file)+1; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
365 lfile_rec.end = 0; // valgrind, avoid writing uninitialized data |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
366 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
46 | 367 } else { |
368 rec_type = 'M'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
369 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
370 mfile_rec.type = item->type; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
371 mfile_rec.line = item->line; |
46 | 372 mfile_rec.funcname = 0; |
373 mfile_rec.filename = strlen(item->function)+1; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
374 mfile_rec.text = mfile_rec.filename+strlen(item->file)+1; |
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
375 mfile_rec.end = 0; // valgrind, avoid writing uninitialized data |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
376 pst_debug_fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp); |
46 | 377 } |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
378 file_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
379 pst_debug_fwrite(item->function, strlen(item->function)+1, 1, debug_fp); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
380 pst_debug_fwrite(item->file, strlen(item->file)+1, 1, debug_fp); |
46 | 381 vfprintf(debug_fp, fmt, *ap); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
382 pst_debug_fwrite(&zero, 1, 1, debug_fp); |
16 | 383 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
384 end = (unsigned int) (ftello(debug_fp) - file_pos); |
16 | 385 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
386 index[2] = ftello(debug_fp); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
387 fseeko(debug_fp, index_pos, SEEK_SET); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
388 pst_debug_fwrite(index, index_size, 1, debug_fp); |
46 | 389 if (size > USHRT_MAX) { |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
390 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
46 | 391 lfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
392 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
46 | 393 } else { |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
394 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
46 | 395 mfile_rec.end = end; |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
396 pst_debug_fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp); |
46 | 397 } |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
398 fseeko(debug_fp, 0, SEEK_END); |
16 | 399 } |
400 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
401 |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
402 void pst_debug_write_hex(struct pst_debug_item *item, char *buf, size_t size, int col) { |
46 | 403 struct pst_debug_file_rec_l lfile_rec; |
404 unsigned char rec_type; | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
405 int index_size = 3 * sizeof(int64_t); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
406 int64_t index_pos, file_pos, index[3]; |
46 | 407 char zero='\0'; |
408 if (!debug_fp) return; // no file | |
409 index[0] = 1; // only one item in this index run | |
410 index[1] = 0; // valgrind, avoid writing uninitialized data | |
411 index[2] = 0; // "" | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
412 index_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
413 pst_debug_fwrite(index, index_size, 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
414 index[1] = ftello(debug_fp); |
16 | 415 |
46 | 416 // always use the long |
417 rec_type = 'L'; | |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
418 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
46 | 419 lfile_rec.funcname = 0; |
420 lfile_rec.filename = strlen(item->function)+1; | |
421 lfile_rec.text = lfile_rec.filename+strlen(item->file)+1; | |
422 lfile_rec.end = 0; // valgrind, avoid writing uninitialized data | |
423 lfile_rec.line = item->line; | |
424 lfile_rec.type = item->type; | |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
425 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
16 | 426 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
427 file_pos = ftello(debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
428 pst_debug_fwrite(item->function, strlen(item->function)+1, 1, debug_fp); |
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
429 pst_debug_fwrite(item->file, strlen(item->file)+1, 1, debug_fp); |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
430 |
46 | 431 pst_debug_hexdumper(debug_fp, buf, size, col, 0); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
432 pst_debug_fwrite(&zero, 1, 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
433 lfile_rec.end = ftello(debug_fp) - file_pos; |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
434 |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
435 index[2] = ftello(debug_fp); |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
436 fseeko(debug_fp, index_pos, SEEK_SET); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
437 pst_debug_fwrite(index, index_size, 1, debug_fp); |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
91
diff
changeset
|
438 pst_debug_fwrite(&rec_type, sizeof(char), 1, debug_fp); |
73
3cb02cb1e6cd
Patch from Robert Simpson to fix doubly-linked list in the cache_ptr code, and allow arrays of unicode strings (without converting them).
Carl Byington <carl@five-ten-sg.com>
parents:
70
diff
changeset
|
439 pst_debug_fwrite(&lfile_rec, sizeof(lfile_rec), 1, debug_fp); |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
440 fseeko(debug_fp, 0, SEEK_END); |
16 | 441 } |
442 | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
443 |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
444 void *pst_malloc(size_t size) { |
46 | 445 void *mem = malloc(size); |
446 if (!mem) { | |
172
6954d315aaa8
move version-info into main configure.in, and set it properly.
Carl Byington <carl@five-ten-sg.com>
parents:
129
diff
changeset
|
447 fprintf(stderr, "pst_malloc: Out Of memory [req: %ld]\n", (long)size); |
46 | 448 exit(1); |
449 } | |
450 return mem; | |
33
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
451 } |
12cac756bc05
enable -d option, but if not specified, don't generate a debug file
carl
parents:
31
diff
changeset
|
452 |