static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-#ifdef SMARTALLOC
-
#define HEAD_SIZE BALIGN(sizeof(struct abufhead))
+#ifdef SMARTALLOC
+
POOLMEM *sm_get_pool_memory(const char *fname, int lineno, int pool)
{
struct abufhead *buf;
return (POOLMEM *)((char *)buf+HEAD_SIZE);
}
- if ((buf=malloc(pool_ctl[pool].size+HEAD_SIZE)) == NULL) {
+ if ((buf=(struct abufhead*)malloc(pool_ctl[pool].size+HEAD_SIZE)) == NULL) {
V(mutex);
Emsg1(M_ABORT, 0, _("Out of memory requesting %d bytes\n"), pool_ctl[pool].size);
}
struct abufhead *buf;
int pool = 0;
- if ((buf=malloc(size+HEAD_SIZE)) == NULL) {
+ if ((buf=(struct abufhead *)malloc(size+HEAD_SIZE)) == NULL) {
Emsg1(M_ABORT, 0, _("Out of memory requesting %d bytes\n"), size);
}
buf->ablen = size;
#define actuallymalloc(x) malloc(x)
#define actuallycalloc(x,y) calloc(x,y)
#define actuallyrealloc(x,y) realloc(x,y)
-#define sm_dump(x)
+inline void sm_dump(int x, int y=0) {} /* with default arguments, we can't use a #define */
#define sm_static(x)
#define sm_new_owner(a, b, c)
#define sm_malloc(f, l, n) malloc(n)
#define sm_check(f, l, fl)
#define sm_check_rtn(f, l, fl) 1
-extern void *b_malloc();
+extern void *b_malloc(const char *file, int line, size_t size);
#define malloc(x) b_malloc(__FILE__, __LINE__, (x))
+#define Dsm_check(lvl)
+#define sm_check(f, l, fl)
+#define sm_check_rtn(f, l, fl) 1
#endif
}
};
#endif /* SMARTALLOC */
-
#endif /* !SMARTALLOC_H */