* Also include strbuff from xbt.h public header
* xbt_ex_display(): do not free the exception after displaying
This allows to do more with the given exception afterward.
- Users should call xbt_ex_free() themselves.
+ Users should call xbt_ex_free() themselves.
+ * Do not allow malloc(0) since that's not portable
-- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
}
return res;
}
+extern void xbt_backtrace_display_current(void);
+
/** @brief Like malloc, but xbt_die() on error
@hideinitializer */
static XBT_INLINE void *xbt_malloc(unsigned int n){
void *res;
-/* if (n==0) xbt_die("malloc(0) is not portable"); */
+ if (n==0) {
+ xbt_backtrace_display_current();
+ xbt_die("malloc(0) is not portable");
+ }
+
res=malloc(n);
if (!res)
xbt_die(bprintf("Memory allocation of %d bytes failed",n));
@hideinitializer */
static XBT_INLINE void *xbt_malloc0(unsigned int n) {
void *res;
-/* if (n==0) xbt_die("calloc(0) is not portable"); */
+ if (n==0) xbt_die("calloc(0) is not portable");
res=calloc(n,1);
if (!res)
xbt_die(bprintf("Memory callocation of %d bytes failed",n));
@hideinitializer */
static XBT_INLINE void *xbt_realloc(void*p,unsigned int s){
void *res=res;
-/* if (s==0) xbt_die("realloc(0) is not portable"); */
+ if (s==0) xbt_die("realloc(0) is not portable");
if (s) {
if (p) {
res=realloc(p,s);
i=xbt_new(Clause,1);
i->num_lits = 0;
- i->literals = xbt_new(int, 0);
+ i->literals = NULL;
DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
DEBUG1("created count=%d",i->num_lits);