git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6290
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
* 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.
* 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>
-- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
+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;
/** @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));
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;
@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));
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;
@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);
if (s) {
if (p) {
res=realloc(p,s);
i=xbt_new(Clause,1);
i->num_lits = 0;
i=xbt_new(Clause,1);
i->num_lits = 0;
- i->literals = xbt_new(int, 0);
DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
DEBUG1("created count=%d",i->num_lits);
DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
DEBUG1("created count=%d",i->num_lits);