#ifndef H_NJ_SMA_0608051240 #define H_NJ_SMA_0608051240 #include /* macros ============================================================== */ #ifdef NDEBUG # define sma_init(f) # define sma_malloc(size) malloc (size) # define sma_calloc(nbobj, size) calloc ((nbobj), (size)) # define sma_realloc(p, size) realloc ((p), (size)) # define sma_register(p) # define sma_free(p) do {free (p); p = NULL;} while (0) # define sma_profil() # define sma_end() # define DP #else # define sma_init(f) sma_init_ (f) # define sma_malloc(size) sma_malloc_ ((size), __FILE__, __LINE__) # define sma_calloc(nbobj, size) sma_malloc_ ((nbobj) * (size), __FILE__, __LINE__) # define sma_realloc(p, size) sma_realloc_ ((p), (size), __FILE__, __LINE__, #p) # define sma_register(p) sma_register_ ((p), __FILE__, __LINE__, #p) # define sma_free(p) do {sma_free_ ((p), __FILE__, __LINE__, #p); p = NULL;} while (0) # define sma_profil() sma_profil_ ( __FILE__, __LINE__) # define sma_end() sma_end_ (__FILE__, __LINE__) # define DP printf ("%s:%d\n", __FILE__, __LINE__) #endif /* NDEBUG */ /* constants =========================================================== */ /* types =============================================================== */ /* structures ========================================================== */ /* internal public functions =========================================== */ /* entry points ======================================================== */ void sma_init_ (const char *); void *sma_malloc_ (size_t, const char *, int); void *sma_realloc_ (void *, size_t, const char *, int, const char *); void sma_register_ (void *p, const char *, int, const char *); void sma_free_ (void *, const char *, int, const char *); void sma_profil_ (const char*, int); void sma_end_ (const char *, int); /* public variables ==================================================== */ #endif /* not H_NJ_SMA_0608051240 */