xmemory.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------*/
00020 /*----------------------------------------------------------------------------*/
00021 
00022 /*
00023     $Id: xmemory.h,v 1.2 2004/06/23 09:53:27 amodigli Exp $
00024     $Author: amodigli $
00025     $Date: 2004/06/23 09:53:27 $
00026     $Revision: 1.2 $
00027 */
00028 
00029 #ifndef XMEMORY_H
00030 #define XMEMORY_H
00031 
00032 /*-----------------------------------------------------------------------------
00033                                 Includes
00034  -----------------------------------------------------------------------------*/
00035 
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038 #include <string.h>
00039 
00040 /*-----------------------------------------------------------------------------
00041                                 Defines
00042  -----------------------------------------------------------------------------*/
00043 
00044 /* To know if the current module has been linked against xmemory.c or not */
00045 #define _XMEMORY_   1
00046 
00047 /*-----------------------------------------------------------------------------
00048                                 Macros
00049  -----------------------------------------------------------------------------*/
00050 
00051 /* Protect strdup redefinition on systems which #define it */
00052 #ifdef strdup
00053 #undef strdup
00054 #endif
00055 
00056 #define malloc(s)       xmemory_malloc(s,       __FILE__,__LINE__)
00057 #define calloc(n,s)     xmemory_calloc(n,s,     __FILE__,__LINE__)
00058 #define realloc(p,s)    xmemory_realloc(p,s,    __FILE__,__LINE__)
00059 #define free(p)         xmemory_free(p,         __FILE__,__LINE__)
00060 #define strdup(s)       xmemory_strdup(s,       __FILE__,__LINE__)
00061 #define falloc(f,o,s)   xmemory_falloc(f,o,s,   __FILE__,__LINE__)
00062 
00063 /* Trick to have xmemory status display the file name and line */
00064 #define xmemory_status() xmemory_status_(__FILE__,__LINE__)
00065 #define xmemory_diagnostics() xmemory_status_(__FILE__,__LINE__)
00066 
00067 /*-----------------------------------------------------------------------------
00068                             Function prototypes
00069  -----------------------------------------------------------------------------*/
00070 
00071 void *  xmemory_malloc(size_t, char *, int) ;
00072 void *  xmemory_calloc(size_t, size_t, char *, int) ;
00073 void *  xmemory_realloc(void *, size_t, char *, int) ;
00074 void    xmemory_free(void *, char *, int) ;
00075 char *  xmemory_strdup(char *, char *, int) ;
00076 char *  xmemory_falloc(char *, size_t, size_t *, char *, int) ;
00077 
00078 void xmemory_on(void) ;
00079 void xmemory_off(void) ; 
00080 void xmemory_status_(char * filename, int lineno) ;
00081 void xmemory_settmpdir(char * dirname) ;
00082 char * xmemory_gettmpdir(void);
00083 
00084 #endif
00085 /* vim: set ts=4 et sw=4 tw=75 */

Generated on Wed Oct 26 13:08:56 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001