Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
mcw_malloc.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef _MCW_MALLOC_HEADER_
00008 #define _MCW_MALLOC_HEADER_
00009
00010
00011
00012
00013 #include <stdlib.h>
00014 #include <stdio.h>
00015 #include <X11/Intrinsic.h>
00016
00017 #include "machdep.h"
00018
00019
00020 #ifdef DONT_USE_MCW_MALLOC
00021
00022 #define MCW_MALLOC_enabled 0
00023
00024 #define MCW_MALLOC_status NULL
00025
00026 #undef mcw_malloc
00027 #define mcw_malloc malloc
00028
00029 #undef mcw_realloc
00030 #define mcw_realloc realloc
00031
00032 #undef mcw_calloc
00033 #define mcw_calloc calloc
00034
00035 #undef mcw_free
00036 #define mcw_free free
00037
00038
00039 #else
00040
00041 #define USING_MCW_MALLOC
00042
00043
00044
00045 #undef malloc
00046 #undef realloc
00047 #undef calloc
00048 #undef free
00049
00050 #define malloc(a) mcw_malloc((a),__FILE__,__LINE__)
00051 #define realloc(a,b) mcw_realloc((a),(b),__FILE__,__LINE__)
00052 #define calloc(a,b) mcw_calloc((a),(b),__FILE__,__LINE__)
00053 #define free mcw_free
00054
00055
00056
00057 extern void enable_mcw_malloc() ;
00058 extern void * mcw_malloc( size_t , char * , int ) ;
00059 extern void * mcw_realloc( void * , size_t , char * , int ) ;
00060 extern void * mcw_calloc( size_t , size_t , char * , int ) ;
00061 extern void mcw_free( void * ) ;
00062
00063 extern char * mcw_malloc_status(const char *,int) ;
00064 extern void mcw_malloc_dump(void) ;
00065 extern int mcw_malloc_enabled(void) ;
00066 extern void pause_mcw_malloc(void);
00067 extern void resume_mcw_malloc(void);
00068 extern int mcw_malloc_paused(void);
00069
00070
00071
00072 #define MCW_MALLOC_enabled mcw_malloc_enabled()
00073
00074 #define MCW_MALLOC_status mcw_malloc_status(__FILE__,__LINE__)
00075
00076
00077
00078 #undef XtMalloc
00079 #undef XtRealloc
00080 #undef XtFree
00081 #undef XtCalloc
00082
00083 #define XtMalloc(a) mcw_XtMalloc((a),__FILE__,__LINE__)
00084 #define XtRealloc(a,b) mcw_XtRealloc((char *)(a),(b),__FILE__,__LINE__)
00085 #define XtCalloc(a,b) mcw_XtCalloc((a),(b),__FILE__,__LINE__)
00086 #define XtFree(a) mcw_XtFree((char *)(a))
00087
00088 extern char * mcw_XtMalloc( Cardinal , char * , int ) ;
00089 extern char * mcw_XtRealloc( char * , Cardinal , char * , int ) ;
00090 extern char * mcw_XtCalloc( Cardinal , Cardinal , char * , int ) ;
00091 extern void mcw_XtFree( char * ) ;
00092
00093 #endif
00094
00095
00096
00097
00098 #define myXtFree(xp) (XtFree((char *)(xp)) , (xp)=NULL)
00099 #define myXtNew(type) ((type *) XtCalloc(1,(Cardinal) sizeof(type)))
00100 #define myfree(xp) (free((xp)) , (xp)=NULL)
00101
00102 #endif