malloc.h

Go to the documentation of this file.
00001 
00013 #if !defined(INC_OSKI_MALLOC_H)
00014 
00015 #define INC_OSKI_MALLOC_H
00016 
00020 typedef void *(*oski_mallocfunc_t) (size_t);
00021 
00025 typedef void *(*oski_reallocfunc_t) (void *, size_t);
00026 
00030 typedef void (*oski_freefunc_t) (void *);
00031 
00036 void *oski_MallocInternal (const char *elem_type, size_t elem_size,
00037                size_t num_elems, const char *source_file,
00038                unsigned long line_number);
00039 
00044 int oski_ReallocInternal (void **p_ptr,
00045               const char *elem_type, size_t elem_size,
00046               size_t num_elems, const char *source_file,
00047               unsigned long line_number);
00048 
00052 void oski_FreeInternal (void *ptr);
00053 
00057 int oski_MultiMalloc (const char *file, unsigned long line, int k, ...);
00058 
00075 #define oski_Malloc( elem_type, num_elems ) \
00076     (elem_type *)oski_MallocInternal( \
00077         #elem_type, sizeof(elem_type), (num_elems), __FILE__, __LINE__ )
00078 
00085 #define oski_MallocNoError( elem_type, num_elems ) \
00086     (elem_type *)oski_MallocInternal( \
00087         #elem_type, sizeof(elem_type), (num_elems), NULL, -1 )
00088 
00106 #define oski_Realloc( ptr_addr, elem_type, num_elems ) \
00107     oski_ReallocInternal( ptr_addr, #elem_type, sizeof(elem_type), \
00108         num_elems, __FILE__, __LINE__ )
00109 
00118 #define oski_Free( ptr ) oski_FreeInternal( ptr )
00119 
00123 void oski_FreeAll (int k, ...);
00124 
00128 oski_mallocfunc_t oski_GetMalloc (void);
00129 
00133 oski_reallocfunc_t oski_GetRealloc (void);
00134 
00138 oski_freefunc_t oski_GetFree (void);
00139 
00143 oski_mallocfunc_t oski_SetMalloc (oski_mallocfunc_t new_func);
00144 
00148 oski_reallocfunc_t oski_SetRealloc (oski_reallocfunc_t new_func);
00149 
00153 oski_freefunc_t oski_SetFree (oski_freefunc_t new_func);
00154 
00158 void oski_ZeroMem (void *buf, size_t num_bytes);
00159 
00160 #endif /* !defined(INC_OSKI_MALLOC_H) */
00161 
00162 /* eof */

Generated on Wed Sep 19 16:41:18 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6