Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

smalloc.h File Reference

#include <stdlib.h>
#include "debug.h"

Go to the source code of this file.

Defines

#define M_EXIT   1
#define M_DONTEXIT   2
#define M_ZERO   4
#define MALLOC(ptr, cast, size, flags)
#define FREE(ptr)


Define Documentation

#define FREE ptr   ) 
 

Value:

do {                                                                    \
        if ((ptr) == NULL)                                              \
        {                                                               \
                DebugMessage(DEBUG_ALL, "free: NULL pointer given as an argument\n");                                                                   \
                exit(1);                                                \
        }                                                               \
        free((ptr));                                                    \
        ptr = NULL;                                                     \
} while(0)

Definition at line 54 of file smalloc.h.

#define M_DONTEXIT   2
 

Definition at line 37 of file smalloc.h.

#define M_EXIT   1
 

Definition at line 36 of file smalloc.h.

#define M_ZERO   4
 

Definition at line 38 of file smalloc.h.

#define MALLOC ptr,
cast,
size,
flags   ) 
 

Value:

do {                                                                    \
        (ptr) = (cast) malloc((size));                                  \
        if (!((flags) & M_DONTEXIT) && ((ptr)  == NULL))                \
        {                                                               \
                DebugMessage(DEBUG_ALL, "malloc: out of memory (allocating %d bytes)\n", (size));                                                       \
                exit(1);                                                \
        }                                                               \
        if (((flags) & M_ZERO) && ((ptr) != NULL))                      \
                memset((ptr), '\0', (size));                            \
} while (0)

Definition at line 41 of file smalloc.h.


Generated on Sun May 14 14:51:27 2006 by  doxygen 1.4.2