1 #ifndef MP_MPATROL_H
2 #define MP_MPATROL_H
3
4
5 /*
6 * mpatrol
7 * A library for controlling and tracing dynamic memory allocations.
8 * Copyright (C) 1997-2002 Graeme S. Roy <graeme.roy@analog.com>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU Library General Public
21 * License along with this library; if not, write to the Free
22 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307, USA.
24 */
25
26
27 /*
28 * $Id: mpatrol.h,v 1.141 2002/01/08 22:29:59 graeme Exp $
29 */
30
31
32 #include <stdlib.h>
33 #include <string.h>
34 #include <stdarg.h>
35 #include <unistd.h>
36 #if !MP_NOCPLUSPLUS
37 #ifdef __cplusplus
38 #include <new>
39 #endif /* __cplusplus */
40 #endif /* MP_NOCPLUSPLUS */
41 #ifdef NDEBUG
42 #include <mpalloc.h>
43 #endif /* NDEBUG */
44
45
46 /* The version of the mpatrol library. The version is of the format vrrff,
47 * where v represents the version number, rr represents the revision number
48 * and ff represents the bug fix count.
49 */
50
51 #define MPATROL_VERSION 10408
52
53
54 /* A macro for representing constant function parameters.
55 */
56
57 #ifndef MP_CONST
58 #if defined(__STDC__) || defined(__cplusplus)
59 #define MP_CONST const
60 #else /* __STDC__ && __cplusplus */
61 #define MP_CONST
62 #endif /* __STDC__ && __cplusplus */
63 #endif /* MP_CONST */
64
65
66 /* A macro for representing a volatile object that may not have any loads
67 * from it or stores to it optimised away.
68 */
69
70 #ifndef MP_VOLATILE
71 #if defined(__STDC__) || defined(__cplusplus)
72 #define MP_VOLATILE volatile
73 #else /* __STDC__ && __cplusplus */
74 #define MP_VOLATILE
75 #endif /* __STDC__ && __cplusplus */
76 #endif /* MP_VOLATILE */
77
78
79 /* A macro for determining the alignment of a type at compile-time.
80 * This resolves to 0 if the compiler has no mechanism for doing this.
81 */
82
83 #ifndef MP_ALIGN
84 #ifdef __EDG__
85 #define MP_ALIGN(t) __ALIGNOF__(t)
86 #elif defined(__GNUC__)
87 #define MP_ALIGN(t) __alignof__(t)
88 #else /* __EDG__ && __GNUC__ */
89 #define MP_ALIGN(t) 0
90 #endif /* __EDG__ && __GNUC__ */
91 #endif /* MP_ALIGN */
92
93
94 /* A macro for determining the current function name.
95 */
96
97 #ifndef MP_FUNCNAME
98 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ == 199901L)
99 #define MP_FUNCNAME __func__
100 #elif defined(__GNUC__)
101 #define MP_FUNCNAME __PRETTY_FUNCTION__
102 #else /* __STDC_VERSION__ && __GNUC__ */
103 #define MP_FUNCNAME NULL
104 #endif /* __STDC_VERSION__ && __GNUC__ */
105 #endif /* MP_FUNCNAME */
106
107
108 /* A macro for defining the visibility of the inline C++ operators. This
109 * should be extern inline so that there is no non-inline definition, but
110 * most compilers do not support this concept yet.
111 */
112
113 #ifndef MP_INLINE
114 #ifdef __GNUC__
115 #define MP_INLINE extern inline
116 #else /* __GNUC__ */
117 #define MP_INLINE static inline
118 #endif /* __GNUC__ */
119 #endif /* MP_INLINE */
120
121
122 /* A macro for disabling the definition of replacement C++ operators.
123 */
124
125 #ifndef MP_NOCPLUSPLUS
126 #define MP_NOCPLUSPLUS 0
127 #endif /* MP_NOCPLUSPLUS */
128
129
130 /* A macro for requiring the use of MP_NEW and MP_DELETE instead of new
131 * and delete in order to use the mpatrol versions of the C++ operators.
132 */
133
134 #ifndef MP_NONEWDELETE
135 #define MP_NONEWDELETE 0
136 #endif /* MP_NONEWDELETE */
137
138
139 /* Options for backwards compatibility with other versions of mallopt(). They
140 * are all currently ignored as they have no meaning when used with mpatrol.
141 */
142
143 #ifdef M_MXFAST
144 #undef M_MXFAST
145 #endif /* M_MXFAST */
146 #ifdef M_NLBLKS
147 #undef M_NLBLKS
148 #endif /* M_NLBLKS */
149 #ifdef M_GRAIN
150 #undef M_GRAIN
151 #endif /* M_GRAIN */
152 #ifdef M_KEEP
153 #undef M_KEEP
154 #endif /* M_KEEP */
155 #ifdef M_TRIM_THRESHOLD
156 #undef M_TRIM_THRESHOLD
157 #endif /* M_TRIM_THRESHOLD */
158 #ifdef M_TOP_PAD
159 #undef M_TOP_PAD
160 #endif /* M_TOP_PAD */
161 #ifdef M_MMAP_THRESHOLD
162 #undef M_MMAP_THRESHOLD
163 #endif /* M_MMAP_THRESHOLD */
164 #ifdef M_MMAP_MAX
165 #undef M_MMAP_MAX
166 #endif /* M_MMAP_MAX */
167 #ifdef M_CHECK_ACTION
168 #undef M_CHECK_ACTION
169 #endif /* M_CHECK_ACTION */
170
171 #define M_MXFAST 1
172 #define M_NLBLKS 2
173 #define M_GRAIN 3
174 #define M_KEEP 4
175 #define M_TRIM_THRESHOLD 5
176 #define M_TOP_PAD 6
177 #define M_MMAP_THRESHOLD 7
178 #define M_MMAP_MAX 8
179 #define M_CHECK_ACTION 9
180
181
182 /* Options that can be set using mallopt(). They all correspond to their
183 * environment variable option equivalent except for MP_OPT_SETFLAGS and
184 * MP_OPT_UNSETFLAGS.
185 */
186
187 #define MP_OPT_HELP 0
188 #define MP_OPT_SETFLAGS -1
189 #define MP_OPT_UNSETFLAGS -2
190 #define MP_OPT_ALLOCSTOP -3
191 #define MP_OPT_REALLOCSTOP -4
192 #define MP_OPT_FREESTOP -5
193 #define MP_OPT_ALLOCBYTE -6
194 #define MP_OPT_FREEBYTE -7
195 #define MP_OPT_OFLOWBYTE -8
196 #define MP_OPT_OFLOWSIZE -9
197 #define MP_OPT_DEFALIGN -10
198 #define MP_OPT_LIMIT -11
199 #define MP_OPT_FAILFREQ -12
200 #define MP_OPT_FAILSEED -13
201 #define MP_OPT_UNFREEDABORT -14
202 #define MP_OPT_LOGFILE -15
203 #define MP_OPT_PROFFILE -16
204 #define MP_OPT_TRACEFILE -17
205 #define MP_OPT_PROGFILE -18
206 #define MP_OPT_AUTOSAVE -19
207 #define MP_OPT_CHECKLOWER -20
208 #define MP_OPT_CHECKUPPER -21
209 #define MP_OPT_CHECKFREQ -22
210 #define MP_OPT_NOFREE -23
211 #define MP_OPT_SMALLBOUND -24
212 #define MP_OPT_MEDIUMBOUND -25
213 #define MP_OPT_LARGEBOUND -26
214
215
216 /* Flags that can be set or unset using mallopt() and MP_OPT_SETFLAGS or
217 * MP_OPT_UNSETFLAGS respectively. They all correspond to their environment
218 * variable option equivalent except for MP_FLG_PAGEALLOC and MP_FLG_ALLOCUPPER.
219 */
220
221 #define MP_FLG_CHECKALL (MP_FLG_CHECKALLOCS | MP_FLG_CHECKREALLOCS | \
222 MP_FLG_CHECKFREES | MP_FLG_CHECKMEMORY)
223 #define MP_FLG_CHECKALLOCS 0x00000001
224 #define MP_FLG_CHECKREALLOCS 0x00000002
225 #define MP_FLG_CHECKFREES 0x00000004
226 #define MP_FLG_CHECKMEMORY 0x00000008
227 #define MP_FLG_LOGALL (MP_FLG_LOGALLOCS | MP_FLG_LOGREALLOCS | \
228 MP_FLG_LOGFREES | MP_FLG_LOGMEMORY)
229 #define MP_FLG_LOGALLOCS 0x00000010
230 #define MP_FLG_LOGREALLOCS 0x00000020
231 #define MP_FLG_LOGFREES 0x00000040
232 #define MP_FLG_LOGMEMORY 0x00000080
233 #define MP_FLG_SHOWALL (MP_FLG_SHOWMAP | MP_FLG_SHOWSYMBOLS | \
234 MP_FLG_SHOWFREE | MP_FLG_SHOWFREED | \
235 MP_FLG_SHOWUNFREED)
236 #define MP_FLG_SHOWMAP 0x00000100
237 #define MP_FLG_SHOWSYMBOLS 0x00000200
238 #define MP_FLG_SHOWFREE 0x00000400
239 #define MP_FLG_SHOWFREED 0x00000800
240 #define MP_FLG_SHOWUNFREED 0x00001000
241 #define MP_FLG_LEAKTABLE 0x00002000
242 #define MP_FLG_ALLOWOFLOW 0x00004000
243 #define MP_FLG_PROF 0x00008000
244 #define MP_FLG_TRACE 0x00010000
245 #define MP_FLG_SAFESIGNALS 0x00020000
246 #define MP_FLG_NOPROTECT 0x00040000
247 #define MP_FLG_CHECKFORK 0x00080000
248 #define MP_FLG_PRESERVE 0x00100000
249 #define MP_FLG_OFLOWWATCH 0x00200000
250 #define MP_FLG_PAGEALLOC 0x00400000
251 #define MP_FLG_ALLOCUPPER 0x00800000
252 #define MP_FLG_USEMMAP 0x01000000
253 #define MP_FLG_USEDEBUG 0x02000000
254 #define MP_FLG_EDIT 0x04000000
255 #define MP_FLG_LIST 0x08000000
256 #define MP_FLG_HTML 0x10000000
257
258
259 /* The various options and flags that can be passed to __mp_leaktable().
260 * Only one of the options must be passed as its second parameter and any
261 * combination of the flags can be passed as its third parameter.
262 */
263
264 #define MP_LT_ALLOCATED 0
265 #define MP_LT_FREED 1
266 #define MP_LT_UNFREED 2
267
268 #define MP_LT_COUNTS 1
269 #define MP_LT_BOTTOM 2
270
271
272 #ifndef MP_MPALLOC_H
273 /* The type of the allocation failure handler. This is only defined if
274 * mpalloc.h has not already been included.
275 */
276
277 typedef void *__mp_failhandler;
278 #endif /* MP_MPALLOC_H */
279
280
281 /* The types of the prologue, epilogue and low memory handlers.
282 */
283
284 typedef void (*__mp_prologuehandler)(MP_CONST void *, size_t, size_t,
285 MP_CONST char *, MP_CONST char *,
286 unsigned long, MP_CONST void *);
287 typedef void (*__mp_epiloguehandler)(MP_CONST void *, MP_CONST char *,
288 MP_CONST char *, unsigned long,
289 MP_CONST void *);
290 typedef void (*__mp_nomemoryhandler)(MP_CONST char *, MP_CONST char *,
291 unsigned long, MP_CONST void *);
292
293
294 /* The different types of warnings and errors reported by the mpatrol library.
295 */
296
297 typedef enum __mp_errortype
298 {
299 MP_ET_NONE, /* no error */
300 MP_ET_ALLOVF, /* allocation overflow */
301 MP_ET_ALLZER, /* allocation too small */
302 MP_ET_BADALN, /* illegal alignment */
303 MP_ET_FRDCOR, /* freed memory corruption */
304 MP_ET_FRDOPN, /* illegal operation on freed memory */
305 MP_ET_FRDOVF, /* freed allocation overflow */
306 MP_ET_FRECOR, /* free memory corruption */
307 MP_ET_FREMRK, /* freeing a marked allocation */
308 MP_ET_FRENUL, /* freeing a NULL pointer */
309 MP_ET_FREOPN, /* illegal operation on free memory */
310 MP_ET_ILLMEM, /* illegal memory access */
311 MP_ET_INCOMP, /* incompatible functions */
312 MP_ET_MAXALN, /* alignment too large */
313 MP_ET_MISMAT, /* allocated pointer mismatch */
314 MP_ET_NOTALL, /* no such allocation */
315 MP_ET_NULOPN, /* illegal operation on a NULL pointer */
316 MP_ET_OUTMEM, /* out of memory */
317 MP_ET_PRVFRD, /* allocation already freed */
318 MP_ET_RNGOVF, /* range overflow */
319 MP_ET_RNGOVL, /* range overlap */
320 MP_ET_RSZNUL, /* reallocating a NULL pointer */
321 MP_ET_RSZZER, /* reallocation too small */
322 MP_ET_STROVF, /* string overflow */
323 MP_ET_ZERALN, /* alignment too small */
324 MP_ET_MAX
325 }
326 __mp_errortype;
327
328
329 /* The different types of memory allocation and operation functions.
330 */
331
332 typedef enum __mp_alloctype
333 {
334 MP_AT_MALLOC, /* malloc() */
335 MP_AT_CALLOC, /* calloc() */
336 MP_AT_MEMALIGN, /* memalign() */
337 MP_AT_VALLOC, /* valloc() */
338 MP_AT_PVALLOC, /* pvalloc() */
339 MP_AT_ALLOCA, /* alloca() */
340 MP_AT_STRDUP, /* strdup() */
341 MP_AT_STRNDUP, /* strndup() */
342 MP_AT_STRSAVE, /* strsave() */
343 MP_AT_STRNSAVE, /* strnsave() */
344 MP_AT_STRDUPA, /* strdupa() */
345 MP_AT_STRNDUPA, /* strndupa() */
346 MP_AT_REALLOC, /* realloc() */
347 MP_AT_REALLOCF, /* reallocf() */
348 MP_AT_RECALLOC, /* recalloc() */
349 MP_AT_EXPAND, /* expand() */
350 MP_AT_FREE, /* free() */
351 MP_AT_CFREE, /* cfree() */
352 MP_AT_DEALLOCA, /* dealloca() */
353 MP_AT_XMALLOC, /* xmalloc() */
354 MP_AT_XCALLOC, /* xcalloc() */
355 MP_AT_XSTRDUP, /* xstrdup() */
356 MP_AT_XREALLOC, /* xrealloc() */
357 MP_AT_XFREE, /* xfree() */
358 MP_AT_NEW, /* operator new */
359 MP_AT_NEWVEC, /* operator new[] */
360 MP_AT_DELETE, /* operator delete */
361 MP_AT_DELETEVEC, /* operator delete[] */
362 MP_AT_MEMSET, /* memset() */
363 MP_AT_BZERO, /* bzero() */
364 MP_AT_MEMCCPY, /* memccpy() */
365 MP_AT_MEMCPY, /* memcpy() */
366 MP_AT_MEMMOVE, /* memmove() */
367 MP_AT_BCOPY, /* bcopy() */
368 MP_AT_MEMCHR, /* memchr() */
369 MP_AT_MEMMEM, /* memmem() */
370 MP_AT_MEMCMP, /* memcmp() */
371 MP_AT_BCMP, /* bcmp() */
372 MP_AT_MAX
373 }
374 __mp_alloctype;
375
376
377 /* The details of a single function in a call stack.
378 */
379
380 typedef struct __mp_allocstack
381 {
382 struct __mp_allocstack *next; /* next address node in call stack */
383 char *name; /* name of function */
384 void *addr; /* return address in function */
385 }
386 __mp_allocstack;
387
388
389 /* The details of a single memory allocation.
390 */
391
392 typedef struct __mp_allocinfo
393 {
394 void *block; /* pointer to block of memory */
395 size_t size; /* size of block of memory */
396 __mp_alloctype type; /* type of memory allocation */
397 unsigned long alloc; /* allocation index */
398 unsigned long realloc; /* reallocation index */
399 unsigned long thread; /* thread identifier */
400 unsigned long event; /* event of last modification */
401 char *func; /* calling function name */
402 char *file; /* file name in which call took place */
403 unsigned long line; /* line number at which call took place */
404 __mp_allocstack *stack; /* call stack details */
405 char *typestr; /* type stored in allocation */
406 size_t typesize; /* size of type stored in allocation */
407 void *userdata; /* user data associated with allocation */
408 int allocated : 1; /* allocation was allocated */
409 int freed : 1; /* allocation has been freed */
410 int marked : 1; /* allocation has been marked */
411 int profiled : 1; /* allocation has been profiled */
412 int traced : 1; /* allocation has been traced */
413 int internal : 1; /* allocation is internal */
414 }
415 __mp_allocinfo;
416
417
418 /* The details of a particular function symbol.
419 */
420
421 typedef struct __mp_symbolinfo
422 {
423 char *name; /* symbol name */
424 char *object; /* module symbol located in */
425 void *addr; /* start address */
426 size_t size; /* size of symbol */
427 char *file; /* file name corresponding to address */
428 unsigned long line; /* line number corresponding to address */
429 }
430 __mp_symbolinfo;
431
432
433 /* The details of the current heap state.
434 */
435
436 typedef struct __mp_heapinfo
437 {
438 size_t acount; /* total number of allocated blocks */
439 size_t atotal; /* total size of allocated blocks */
440 size_t fcount; /* total number of free blocks */
441 size_t ftotal; /* total size of free blocks */
442 size_t gcount; /* total number of freed blocks */
443 size_t gtotal; /* total size of freed blocks */
444 size_t icount; /* total number of internal blocks */
445 size_t itotal; /* total size of internal blocks */
446 size_t mcount; /* total number of marked blocks */
447 size_t mtotal; /* total size of marked blocks */
448 }
449 __mp_heapinfo;
450
451
452 /* The structure filled by mallinfo().
453 */
454
455 struct mallinfo
456 {
457 unsigned long arena; /* total space in arena */
458 unsigned long ordblks; /* number of ordinary blocks */
459 unsigned long smblks; /* number of small blocks */
460 unsigned long hblks; /* number of holding blocks */
461 unsigned long hblkhd; /* space in holding block headers */
462 unsigned long usmblks; /* space in small blocks in use */
463 unsigned long fsmblks; /* space in free small blocks */
464 unsigned long uordblks; /* space in ordinary blocks in use */
465 unsigned long fordblks; /* space in free ordinary blocks */
466 unsigned long keepcost; /* cost of enabling keep option */
467 };
468
469
470 #ifndef NDEBUG
471
472 #ifdef malloc
473 #undef malloc
474 #endif /* malloc */
475 #ifdef calloc
476 #undef calloc
477 #endif /* calloc */
478 #ifdef memalign
479 #undef memalign
480 #endif /* memalign */
481 #ifdef valloc
482 #undef valloc
483 #endif /* valloc */
484 #ifdef pvalloc
485 #undef pvalloc
486 #endif /* pvalloc */
487 #ifdef alloca
488 #undef alloca
489 #endif /* alloca */
490 #ifdef strdup
491 #undef strdup
492 #endif /* strdup */
493 #ifdef strndup
494 #undef strndup
495 #endif /* strndup */
496 #ifdef strsave
497 #undef strsave
498 #endif /* strsave */
499 #ifdef strnsave
500 #undef strnsave
501 #endif /* strnsave */
502 #ifdef strdupa
503 #undef strdupa
504 #endif /* strdupa */
505 #ifdef strndupa
506 #undef strndupa
507 #endif /* strndupa */
508 #ifdef realloc
509 #undef realloc
510 #endif /* realloc */
511 #ifdef reallocf
512 #undef reallocf
513 #endif /* reallocf */
514 #ifdef recalloc
515 #undef recalloc
516 #endif /* recalloc */
517 #ifdef expand
518 #undef expand
519 #endif /* expand */
520 #ifdef free
521 #undef free
522 #endif /* free */
523 #ifdef cfree
524 #undef cfree
525 #endif /* cfree */
526 #ifdef dealloca
527 #undef dealloca
528 #endif /* dealloca */
529 #ifdef xmalloc
530 #undef xmalloc
531 #endif /* xmalloc */
532 #ifdef xcalloc
533 #undef xcalloc
534 #endif /* xcalloc */
535 #ifdef xstrdup
536 #undef xstrdup
537 #endif /* xstrdup */
538 #ifdef xrealloc
539 #undef xrealloc
540 #endif /* xrealloc */
541 #ifdef xfree
542 #undef xfree
543 #endif /* xfree */
544
545 #ifdef memset
546 #undef memset
547 #endif /* memset */
548 #ifdef bzero
549 #undef bzero
550 #endif /* bzero */
551 #ifdef memccpy
552 #undef memccpy
553 #endif /* memccpy */
554 #ifdef memcpy
555 #undef memcpy
556 #endif /* memcpy */
557 #ifdef memmove
558 #undef memmove
559 #endif /* memmove */
560 #ifdef bcopy
561 #undef bcopy
562 #endif /* bcopy */
563 #ifdef memchr
564 #undef memchr
565 #endif /* memchr */
566 #ifdef memmem
567 #undef memmem
568 #endif /* memmem */
569 #ifdef memcmp
570 #undef memcmp
571 #endif /* memcmp */
572 #ifdef bcmp
573 #undef bcmp
574 #endif /* bcmp */
575
576 #ifdef MP_MALLOC
577 #undef MP_MALLOC
578 #endif /* MP_MALLOC */
579 #ifdef MP_CALLOC
580 #undef MP_CALLOC
581 #endif /* MP_CALLOC */
582 #ifdef MP_STRDUP
583 #undef MP_STRDUP
584 #endif /* MP_STRDUP */
585 #ifdef MP_REALLOC
586 #undef MP_REALLOC
587 #endif /* MP_REALLOC */
588 #ifdef MP_FREE
589 #undef MP_FREE
590 #endif /* MP_FREE */
591 #ifdef MP_FAILURE
592 #undef MP_FAILURE
593 #endif /* MP_FAILURE */
594
595 #if !MP_NOCPLUSPLUS
596 #ifdef __cplusplus
597 #if MP_NONEWDELETE
598 #ifdef MP_NEW
599 #undef MP_NEW
600 #endif /* MP_NEW */
601 #ifdef MP_NEW_NOTHROW
602 #undef MP_NEW_NOTHROW
603 #endif /* MP_NEW_NOTHROW */
604 #ifdef MP_DELETE
605 #undef MP_DELETE
606 #endif /* MP_DELETE */
607 #else /* MP_NONEWDELETE */
608 #ifdef new
609 #undef new
610 #endif /* new */
611 #ifdef delete
612 #undef delete
613 #endif /* delete */
614 #endif /* MP_NONEWDELETE */
615 #endif /* __cplusplus */
616 #endif /* MP_NOCPLUSPLUS */
617
618
619 #define malloc(l) \
620 __mp_alloc((l), 0, MP_AT_MALLOC, MP_FUNCNAME, __FILE__, __LINE__, NULL, 0, \
621 0)
622 #define calloc(l, n) \
623 __mp_alloc((l) * (n), 0, MP_AT_CALLOC, MP_FUNCNAME, __FILE__, __LINE__, \
624 NULL, 0, 0)
625 #define memalign(a, l) \
626 __mp_alloc((l), (a), MP_AT_MEMALIGN, MP_FUNCNAME, __FILE__, __LINE__, \
627 NULL, 0, 0)
628 #define valloc(l) \
629 __mp_alloc((l), 0, MP_AT_VALLOC, MP_FUNCNAME, __FILE__, __LINE__, NULL, 0, \
630 0)
631 #define pvalloc(l) \
632 __mp_alloc((l), 0, MP_AT_PVALLOC, MP_FUNCNAME, __FILE__, __LINE__, NULL, \
633 0, 0)
634 #define alloca(l) \
635 __mp_alloc((l), 0, MP_AT_ALLOCA, MP_FUNCNAME, __FILE__, __LINE__, NULL, 0, \
636 0)
637 #define strdup(p) \
638 __mp_strdup((p), 0, MP_AT_STRDUP, MP_FUNCNAME, __FILE__, __LINE__, 0)
639 #define strndup(p, l) \
640 __mp_strdup((p), (l), MP_AT_STRNDUP, MP_FUNCNAME, __FILE__, __LINE__, 0)
641 #define strsave(p) \
642 __mp_strdup((p), 0, MP_AT_STRSAVE, MP_FUNCNAME, __FILE__, __LINE__, 0)
643 #define strnsave(p, l) \
644 __mp_strdup((p), (l), MP_AT_STRNSAVE, MP_FUNCNAME, __FILE__, __LINE__, 0)
645 #define strdupa(p) \
646 __mp_strdup((p), 0, MP_AT_STRDUPA, MP_FUNCNAME, __FILE__, __LINE__, 0)
647 #define strndupa(p, l) \
648 __mp_strdup((p), (l), MP_AT_STRNDUPA, MP_FUNCNAME, __FILE__, __LINE__, 0)
649 #define realloc(p, l) \
650 __mp_realloc((p), (l), 0, MP_AT_REALLOC, MP_FUNCNAME, __FILE__, __LINE__, \
651 NULL, 0, 0)
652 #define reallocf(p, l) \
653 __mp_realloc((p), (l), 0, MP_AT_REALLOCF, MP_FUNCNAME, __FILE__, __LINE__, \
654 NULL, 0, 0)
655 #define recalloc(p, l, n) \
656 __mp_realloc((p), (l) * (n), 0, MP_AT_RECALLOC, MP_FUNCNAME, __FILE__, \
657 __LINE__, NULL, 0, 0)
658 #define expand(p, l) \
659 __mp_realloc((p), (l), 0, MP_AT_EXPAND, MP_FUNCNAME, __FILE__, __LINE__, \
660 NULL, 0, 0)
661 #define free(p) \
662 __mp_free((p), MP_AT_FREE, MP_FUNCNAME, __FILE__, __LINE__, 0)
663 #define cfree(p, l, n) \
664 __mp_free((p), MP_AT_CFREE, MP_FUNCNAME, __FILE__, __LINE__, 0)
665 #define dealloca(p) \
666 __mp_free((p), MP_AT_DEALLOCA, MP_FUNCNAME, __FILE__, __LINE__, 0)
667 #define xmalloc(l) \
668 __mp_alloc((l), 0, MP_AT_XMALLOC, MP_FUNCNAME, __FILE__, __LINE__, NULL, \
669 0, 0)
670 #define xcalloc(l, n) \
671 __mp_alloc((l) * (n), 0, MP_AT_XCALLOC, MP_FUNCNAME, __FILE__, __LINE__, \
672 NULL, 0, 0)
673 #define xstrdup(p) \
674 __mp_strdup((p), 0, MP_AT_XSTRDUP, MP_FUNCNAME, __FILE__, __LINE__, 0)
675 #define xrealloc(p, l) \
676 __mp_realloc((p), (l), 0, MP_AT_XREALLOC, MP_FUNCNAME, __FILE__, __LINE__, \
677 NULL, 0, 0)
678 #define xfree(p) \
679 __mp_free((p), MP_AT_XFREE, MP_FUNCNAME, __FILE__, __LINE__, 0)
680
681 #define memset(p, c, l) \
682 __mp_setmem((p), (l), (unsigned char) (c), MP_AT_MEMSET, MP_FUNCNAME, \
683 __FILE__, __LINE__, 0)
684 #define bzero(p, l) \
685 (void) __mp_setmem((p), (l), 0, MP_AT_BZERO, MP_FUNCNAME, __FILE__, \
686 __LINE__, 0)
687 #define memccpy(q, p, c, l) \
688 __mp_copymem((p), (q), (l), (unsigned char) (c), MP_AT_MEMCCPY, \
689 MP_FUNCNAME, __FILE__, __LINE__, 0)
690 #define memcpy(q, p, l) \
691 __mp_copymem((p), (q), (l), 0, MP_AT_MEMCPY, MP_FUNCNAME, __FILE__, \
692 __LINE__, 0)
693 #define memmove(q, p, l) \
694 __mp_copymem((p), (q), (l), 0, MP_AT_MEMMOVE, MP_FUNCNAME, __FILE__, \
695 __LINE__, 0)
696 #define bcopy(p, q, l) \
697 (void) __mp_copymem((p), (q), (l), 0, MP_AT_BCOPY, MP_FUNCNAME, __FILE__, \
698 __LINE__, 0)
699 #define memchr(p, c, l) \
700 __mp_locatemem((p), (l), NULL, (size_t) (c), MP_AT_MEMCHR, MP_FUNCNAME, \
701 __FILE__, __LINE__, 0)
702 #define memmem(p, l, q, m) \
703 __mp_locatemem((p), (l), (q), (m), MP_AT_MEMMEM, MP_FUNCNAME, __FILE__, \
704 __LINE__, 0)
705 #define memcmp(p, q, l) \
706 __mp_comparemem((p), (q), (l), MP_AT_MEMCMP, MP_FUNCNAME, __FILE__, \
707 __LINE__, 0)
708 #define bcmp(p, q, l) \
709 __mp_comparemem((p), (q), (l), MP_AT_BCMP, MP_FUNCNAME, __FILE__, \
710 __LINE__, 0)
711
712 #define MP_MALLOC(p, l, t) \
713 (p = (t *) __mp_alloc((l) * sizeof(t), MP_ALIGN(t), MP_AT_XMALLOC, \
714 MP_FUNCNAME, __FILE__, __LINE__, #t, sizeof(t), 0))
715 #define MP_CALLOC(p, l, t) \
716 (p = (t *) __mp_alloc((l) * sizeof(t), MP_ALIGN(t), MP_AT_XCALLOC, \
717 MP_FUNCNAME, __FILE__, __LINE__, #t, sizeof(t), 0))
718 #define MP_STRDUP(p, s) \
719 (p = __mp_strdup((s), 0, MP_AT_XSTRDUP, MP_FUNCNAME, __FILE__, __LINE__, 0))
720 #define MP_REALLOC(p, l, t) \
721 (p = (t *) __mp_realloc((p), (l) * sizeof(t), MP_ALIGN(t), MP_AT_XREALLOC, \
722 MP_FUNCNAME, __FILE__, __LINE__, #t, sizeof(t), 0))
723 #define MP_FREE(p) \
724 do { __mp_free((p), MP_AT_XFREE, MP_FUNCNAME, __FILE__, __LINE__, 0); \
725 p = NULL; } while (0)
726 #define MP_FAILURE(f) ((__mp_failhandler) NULL)
727
728 #define __mp_check() \
729 __mp_checkheap(MP_FUNCNAME, __FILE__, __LINE__)
730
731 #define __mp_vlocprintf(m, v) \
732 __mp_vprintfwithloc(MP_FUNCNAME, __FILE__, __LINE__, (m), (v))
733
734
735 #ifdef __cplusplus
736 extern "C"
737 {
738 #endif /* __cplusplus */
739
740
741 extern __mp_errortype __mp_errno;
742
743
744 void __mp_init(void);
745 void __mp_reinit(void);
746 void __mp_fini(void);
747 int __mp_atexit(void (*)(void));
748 unsigned long __mp_setoption(long, unsigned long);
749 int __mp_getoption(long, unsigned long *);
750 void *__mp_alloc(size_t, size_t, __mp_alloctype, MP_CONST char *,
751 MP_CONST char *, unsigned long, MP_CONST char *, size_t,
752 size_t);
753 char *__mp_strdup(MP_CONST char *, size_t, __mp_alloctype, MP_CONST char *,
754 MP_CONST char *, unsigned long, size_t);
755 void *__mp_realloc(void *, size_t, size_t, __mp_alloctype, MP_CONST char *,
756 MP_CONST char *, unsigned long, MP_CONST char *, size_t,
757 size_t);
758 void __mp_free(void *, __mp_alloctype, MP_CONST char *, MP_CONST char *,
759 unsigned long, size_t);
760 void *__mp_setmem(void *, size_t, unsigned char, __mp_alloctype,
761 MP_CONST char *, MP_CONST char *, unsigned long, size_t);
762 void *__mp_copymem(MP_CONST void *, void *, size_t, unsigned char,
763 __mp_alloctype, MP_CONST char *, MP_CONST char *,
764 unsigned long, size_t);
765 void *__mp_locatemem(MP_CONST void *, size_t, MP_CONST void *, size_t,
766 __mp_alloctype, MP_CONST char *, MP_CONST char *,
767 unsigned long, size_t);
768 int __mp_comparemem(MP_CONST void *, MP_CONST void *, size_t, __mp_alloctype,
769 MP_CONST char *, MP_CONST char *, unsigned long, size_t);
770 unsigned long __mp_libversion(void);
771 MP_CONST char *__mp_strerror(__mp_errortype);
772 MP_CONST char *__mp_function(__mp_alloctype);
773 int __mp_setuser(MP_CONST void *, MP_CONST void *);
774 int __mp_setmark(MP_CONST void *);
775 int __mp_info(MP_CONST void *, __mp_allocinfo *);
776 int __mp_syminfo(MP_CONST void *, __mp_symbolinfo *);
777 MP_CONST char *__mp_symbol(MP_CONST void *);
778 int __mp_printinfo(MP_CONST void *);
779 unsigned long __mp_snapshot(void);
780 size_t __mp_iterate(int (*)(MP_CONST void *, void *), void *, unsigned long);
781 size_t __mp_iterateall(int (*)(MP_CONST void *, void *), void *);
782 int __mp_addallocentry(MP_CONST char *, unsigned long, size_t);
783 int __mp_addfreeentry(MP_CONST char *, unsigned long, size_t);
784 void __mp_clearleaktable(void);
785 int __mp_startleaktable(void);
786 int __mp_stopleaktable(void);
787 void __mp_leaktable(size_t, int, unsigned char);
788 void __mp_memorymap(int);
789 void __mp_summary(void);
790 int __mp_stats(__mp_heapinfo *);
791 void __mp_checkheap(MP_CONST char *, MP_CONST char *, unsigned long);
792 __mp_prologuehandler __mp_prologue(MP_CONST __mp_prologuehandler);
793 __mp_epiloguehandler __mp_epilogue(MP_CONST __mp_epiloguehandler);
794 __mp_nomemoryhandler __mp_nomemory(MP_CONST __mp_nomemoryhandler);
795 void __mp_pushdelstack(MP_CONST char *, MP_CONST char *, unsigned long);
796 void __mp_popdelstack(char **, char **, unsigned long *);
797 int __mp_printf(MP_CONST char *, ...);
798 int __mp_vprintf(MP_CONST char *, va_list);
799 void __mp_printfwithloc(MP_CONST char *, MP_CONST char *, unsigned long,
800 MP_CONST char *, ...);
801 void __mp_vprintfwithloc(MP_CONST char *, MP_CONST char *, unsigned long,
802 MP_CONST char *, va_list);
803 void __mp_logmemory(MP_CONST void *, size_t);
804 int __mp_logstack(size_t);
805 int __mp_logaddr(MP_CONST void *);
806 int __mp_edit(MP_CONST char *, unsigned long);
807 int __mp_list(MP_CONST char *, unsigned long);
808 int __mp_view(MP_CONST char *, unsigned long);
809 int __mp_readcontents(MP_CONST char *, void *);
810 int __mp_writecontents(MP_CONST char *, MP_CONST void *);
811 long __mp_cmpcontents(MP_CONST char *, MP_CONST void *);
812 int __mp_remcontents(MP_CONST char *, MP_CONST void *);
813
814
815 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ == 199901L)
816 #define __mp_locprintf(...) \
817 __mp_printfwithloc(MP_FUNCNAME, __FILE__, __LINE__, __VA_ARGS__)
818 #elif defined(__GNUC__)
819 #define __mp_locprintf(a...) \
820 __mp_printfwithloc(MP_FUNCNAME, __FILE__, __LINE__, a)
821 #else /* __STDC_VERSION__ && __GNUC__ */
822 static
823 void
__mp_locprintf(MP_CONST char * m,...)824 __mp_locprintf(MP_CONST char *m, ...)
825 {
826 va_list v;
827
828 va_start(v, m);
829 __mp_vprintfwithloc(NULL, NULL, 0, m, v);
830 va_end(v);
831 }
832 #endif /* __STDC_VERSION__ && __GNUC__ */
833
834
835 #ifdef __cplusplus
836 }
837 #endif /* __cplusplus */
838
839 #else /* NDEBUG */
840
841 static int __mp_errno;
842
843 #define dealloca(p)
844
845 #define MP_NEW new
846 #define MP_NEW_NOTHROW new(std::nothrow)
847 #define MP_DELETE delete
848
849 #define __mp_init() ((void) 0)
850 #define __mp_reinit() ((void) 0)
851 #define __mp_fini() ((void) 0)
852 #define __mp_atexit(f) ((int) 0)
853 #define __mp_setoption(o, v) ((unsigned long) ~0L)
854 #define __mp_getoption(o, v) ((int) 0)
855 #define __mp_alloc(l, a, f, s, t, u, g, h, k) ((void *) NULL)
856 #define __mp_strdup(p, l, f, s, t, u, k) ((char *) NULL)
857 #define __mp_realloc(p, l, a, f, s, t, u, g, h, k) ((void *) NULL)
858 #define __mp_free(p, f, s, t, u, k) ((void) 0)
859 #define __mp_setmem(p, l, c, f, s, t, u, k) ((void *) NULL)
860 #define __mp_copymem(p, q, l, c, f, s, t, u, k) ((void *) NULL)
861 #define __mp_locatemem(p, l, q, m, f, s, t, u, k) ((void *) NULL)
862 #define __mp_comparemem(p, q, l, f, s, t, u, k) ((int) 0)
863 #define __mp_libversion() ((unsigned long) MPATROL_VERSION)
864 #define __mp_strerror(f) ((MP_CONST char *) NULL)
865 #define __mp_function(f) ((MP_CONST char *) NULL)
866 #define __mp_setuser(p, d) ((int) 0)
867 #define __mp_setmark(p) ((int) 0)
868 #define __mp_info(p, d) ((int) 0)
869 #define __mp_syminfo(p, d) ((int) 0)
870 #define __mp_symbol(p) ((MP_CONST char *) NULL)
871 #define __mp_printinfo(p) ((int) 0)
872 #define __mp_snapshot() ((unsigned long) 0)
873 #define __mp_iterate(p, d, s) ((size_t) 0)
874 #define __mp_iterateall(p, d) ((size_t) 0)
875 #define __mp_addallocentry(f, l, c) ((int) 0)
876 #define __mp_addfreeentry(f, l, c) ((int) 0)
877 #define __mp_clearleaktable() ((void) 0)
878 #define __mp_startleaktable() ((int) 0)
879 #define __mp_stopleaktable() ((int) 0)
880 #define __mp_leaktable(l, o, f) ((void) 0)
881 #define __mp_memorymap(s) ((void) 0)
882 #define __mp_summary() ((void) 0)
883 #define __mp_stats(d) ((int) 0)
884 #define __mp_checkheap(s, t, u) ((void) 0)
885 #define __mp_check() ((void) 0)
886 #define __mp_prologue(h) ((__mp_prologuehandler) NULL)
887 #define __mp_epilogue(h) ((__mp_epiloguehandler) NULL)
888 #define __mp_nomemory(h) ((__mp_nomemoryhandler) NULL)
889 #define __mp_pushdelstack(s, t, u) ((void) 0)
890 #define __mp_popdelstack(s, t, u) ((void) 0)
891 #define __mp_vprintf(s, v) ((int) 0)
892 #define __mp_vprintfwithloc(s, t, u, m, v) ((void) 0)
893 #define __mp_vlocprintf(m, v) ((void) 0)
894 #define __mp_logmemory(p, l) ((void) 0)
895 #define __mp_logstack(k) ((int) 0)
896 #define __mp_logaddr(p) ((int) 0)
897 #define __mp_edit(f, l) ((int) 0)
898 #define __mp_list(f, l) ((int) 0)
899 #define __mp_view(f, l) ((int) 0)
900 #define __mp_readcontents(s, p) ((int) 0)
901 #define __mp_writecontents(s, p) ((int) 0)
902 #define __mp_cmpcontents(s, p) ((long) -1)
903 #define __mp_remcontents(s, p) ((int) 0)
904
905 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ == 199901L)
906 #define __mp_printf(...) ((int) 0)
907 #define __mp_printfwithloc(s, t, u, ...) ((void) 0)
908 #define __mp_locprintf(...) ((void) 0)
909 #elif defined(__GNUC__)
910 #define __mp_printf(a...) ((int) 0)
911 #define __mp_printfwithloc(s, t, u, a...) ((void) 0)
912 #define __mp_locprintf(a...) ((void) 0)
913 #else /* __STDC_VERSION__ && __GNUC__ */
914 static
915 int
__mp_printf(MP_CONST char * s,...)916 __mp_printf(MP_CONST char *s, ...)
917 {
918 return 0;
919 }
920
921 static
922 void
__mp_printfwithloc(MP_CONST char * s,MP_CONST char * t,unsigned long u,MP_CONST char * m,...)923 __mp_printfwithloc(MP_CONST char *s, MP_CONST char *t, unsigned long u,
924 MP_CONST char *m, ...)
925 {
926 }
927
928 static
929 void
__mp_locprintf(MP_CONST char * m,...)930 __mp_locprintf(MP_CONST char *m, ...)
931 {
932 }
933 #endif /* __STDC_VERSION__ && __GNUC__ */
934
935 #endif /* NDEBUG */
936
937
938 #define mpatrol_init __mp_init
939 #define mpatrol_reinit __mp_reinit
940 #define mpatrol_fini __mp_fini
941 #define mpatrol_atexit __mp_atexit
942 #define mpatrol_setoption __mp_setoption
943 #define mpatrol_getoption __mp_getoption
944 #define mpatrol_alloc __mp_alloc
945 #define mpatrol_strdup __mp_strdup
946 #define mpatrol_realloc __mp_realloc
947 #define mpatrol_free __mp_free
948 #define mpatrol_setmem __mp_setmem
949 #define mpatrol_copymem __mp_copymem
950 #define mpatrol_locatemem __mp_locatemem
951 #define mpatrol_comparemem __mp_comparemem
952 #define mpatrol_libversion __mp_libversion
953 #define mpatrol_strerror __mp_strerror
954 #define mpatrol_function __mp_function
955 #define mpatrol_setuser __mp_setuser
956 #define mpatrol_setmark __mp_setmark
957 #define mpatrol_info __mp_info
958 #define mpatrol_syminfo __mp_syminfo
959 #define mpatrol_symbol __mp_symbol
960 #define mpatrol_printinfo __mp_printinfo
961 #define mpatrol_snapshot __mp_snapshot
962 #define mpatrol_iterate __mp_iterate
963 #define mpatrol_iterateall __mp_iterateall
964 #define mpatrol_addallocentry __mp_addallocentry
965 #define mpatrol_addfreeentry __mp_addfreeentry
966 #define mpatrol_clearleaktable __mp_clearleaktable
967 #define mpatrol_startleaktable __mp_startleaktable
968 #define mpatrol_stopleaktable __mp_stopleaktable
969 #define mpatrol_leaktable __mp_leaktable
970 #define mpatrol_memorymap __mp_memorymap
971 #define mpatrol_summary __mp_summary
972 #define mpatrol_stats __mp_stats
973 #define mpatrol_checkheap __mp_checkheap
974 #define mpatrol_check __mp_check
975 #define mpatrol_prologue __mp_prologue
976 #define mpatrol_epilogue __mp_epilogue
977 #define mpatrol_nomemory __mp_nomemory
978 #define mpatrol_pushdelstack __mp_pushdelstack
979 #define mpatrol_popdelstack __mp_popdelstack
980 #define mpatrol_printf __mp_printf
981 #define mpatrol_vprintf __mp_vprintf
982 #define mpatrol_printfwithloc __mp_printfwithloc
983 #define mpatrol_vprintfwithloc __mp_vprintfwithloc
984 #define mpatrol_locprintf __mp_locprintf
985 #define mpatrol_vlocprintf __mp_vlocprintf
986 #define mpatrol_logmemory __mp_logmemory
987 #define mpatrol_logstack __mp_logstack
988 #define mpatrol_logaddr __mp_logaddr
989 #define mpatrol_edit __mp_edit
990 #define mpatrol_list __mp_list
991 #define mpatrol_view __mp_view
992 #define mpatrol_readcontents __mp_readcontents
993 #define mpatrol_writecontents __mp_writecontents
994 #define mpatrol_cmpcontents __mp_cmpcontents
995 #define mpatrol_remcontents __mp_remcontents
996
997
998 #if !MP_NOCPLUSPLUS
999 #ifdef __cplusplus
1000 #ifndef NDEBUG
1001
1002
1003 #if !defined(_WIN32) || defined(__GNUC__)
1004 namespace std
1005 {
1006 #endif /* _WIN32 && __GNUC__ */
1007
1008
1009 /* Set the low-memory handler.
1010 */
1011
1012 MP_INLINE
1013 new_handler
set_new_handler(new_handler h)1014 set_new_handler(new_handler h) throw()
1015 {
1016 return (new_handler) __mp_nomemory((__mp_nomemoryhandler) h);
1017 }
1018
1019
1020 #if !defined(_WIN32) || defined(__GNUC__)
1021 }
1022 #endif /* _WIN32 && __GNUC__ */
1023
1024
1025 /* Override operator new.
1026 */
1027
1028 MP_INLINE
1029 void *
new(size_t l,MP_CONST char * s,MP_CONST char * t,unsigned long u)1030 operator new(size_t l, MP_CONST char *s, MP_CONST char *t, unsigned long u)
1031 throw(std::bad_alloc)
1032 {
1033 void *p;
1034
1035 if ((p = __mp_alloc(l, 0, MP_AT_NEW, s, t, u, NULL, 0, 0)) == NULL)
1036 throw std::bad_alloc();
1037 return p;
1038 }
1039
1040
1041 /* Override nothrow version of operator new.
1042 */
1043
1044 MP_INLINE
1045 void *
new(size_t l,MP_CONST char * s,MP_CONST char * t,unsigned long u,MP_CONST std::nothrow_t &)1046 operator new(size_t l, MP_CONST char *s, MP_CONST char *t, unsigned long u,
1047 MP_CONST std::nothrow_t&) throw()
1048 {
1049 return __mp_alloc(l, 0, MP_AT_NEW, s, t, u, NULL, 0, 0);
1050 }
1051
1052
1053 /* Override operator new[].
1054 */
1055
1056 MP_INLINE
1057 void *
1058 operator new[](size_t l, MP_CONST char *s, MP_CONST char *t, unsigned long u)
throw(std::bad_alloc)1059 throw(std::bad_alloc)
1060 {
1061 void *p;
1062
1063 if ((p = __mp_alloc(l, 0, MP_AT_NEWVEC, s, t, u, NULL, 0, 0)) == NULL)
1064 throw std::bad_alloc();
1065 return p;
1066 }
1067
1068
1069 /* Override nothrow version of operator new[].
1070 */
1071
1072 MP_INLINE
1073 void *
1074 operator new[](size_t l, MP_CONST char *s, MP_CONST char *t, unsigned long u,
throw()1075 MP_CONST std::nothrow_t&) throw()
1076 {
1077 return __mp_alloc(l, 0, MP_AT_NEWVEC, s, t, u, NULL, 0, 0);
1078 }
1079
1080
1081 /* Override operator delete.
1082 */
1083
1084 MP_INLINE
1085 void
delete(void * p)1086 operator delete(void *p) throw()
1087 {
1088 char *s, *t;
1089 unsigned long u;
1090
1091 __mp_popdelstack(&s, &t, &u);
1092 __mp_free(p, MP_AT_DELETE, s, t, u, 0);
1093 }
1094
1095
1096 /* Override nothrow version of operator delete.
1097 */
1098
1099 MP_INLINE
1100 void
delete(void * p,MP_CONST std::nothrow_t &)1101 operator delete(void *p, MP_CONST std::nothrow_t&) throw()
1102 {
1103 char *s, *t;
1104 unsigned long u;
1105
1106 __mp_popdelstack(&s, &t, &u);
1107 __mp_free(p, MP_AT_DELETE, s, t, u, 0);
1108 }
1109
1110
1111 /* Override operator delete[].
1112 */
1113
1114 MP_INLINE
1115 void
throw()1116 operator delete[](void *p) throw()
1117 {
1118 char *s, *t;
1119 unsigned long u;
1120
1121 __mp_popdelstack(&s, &t, &u);
1122 __mp_free(p, MP_AT_DELETEVEC, s, t, u, 0);
1123 }
1124
1125
1126 /* Override nothrow version of operator delete[].
1127 */
1128
1129 MP_INLINE
1130 void
throw()1131 operator delete[](void *p, MP_CONST std::nothrow_t&) throw()
1132 {
1133 char *s, *t;
1134 unsigned long u;
1135
1136 __mp_popdelstack(&s, &t, &u);
1137 __mp_free(p, MP_AT_DELETEVEC, s, t, u, 0);
1138 }
1139
1140
1141 #if MP_NONEWDELETE
1142 #define MP_NEW ::new(MP_FUNCNAME, __FILE__, __LINE__)
1143 #define MP_NEW_NOTHROW ::new(MP_FUNCNAME, __FILE__, __LINE__, std::nothrow)
1144 #define MP_DELETE __mp_pushdelstack(MP_FUNCNAME, __FILE__, __LINE__), ::delete
1145 #else /* MP_NONEWDELETE */
1146 #define new ::new(MP_FUNCNAME, __FILE__, __LINE__)
1147 #define delete __mp_pushdelstack(MP_FUNCNAME, __FILE__, __LINE__), ::delete
1148 #endif /* MP_NONEWDELETE */
1149
1150 #endif /* NDEBUG */
1151 #endif /* __cplusplus */
1152 #endif /* MP_NOCPLUSPLUS */
1153
1154
1155 #endif /* MP_MPATROL_H */
1156