-#else /* !__GNUC__ */
-# define _XBT_GNUC_PRINTF( format_idx, arg_idx )
-# define _XBT_GNUC_SCANF( format_idx, arg_idx )
-# define _XBT_GNUC_FORMAT( arg_idx )
-# define _XBT_GNUC_NORETURN
+/** @brief like malloc, but xbt_die() on error and memset data to 0
+ @hideinitializer */
+static XBT_INLINE void *xbt_malloc0(int n) {
+ void *res=calloc(n,1);
+ if (!res)
+ xbt_die(bprintf("Memory callocation of %d bytes failed",n));
+ return res;
+}
+
+/** @brief like realloc, but xbt_die() on error
+ @hideinitializer */
+static XBT_INLINE void *xbt_realloc(void*p,int s){
+ void *res=res;
+ if (s) {
+ if (p) {
+ res=realloc(p,s);
+ if (!res)
+ xbt_die(bprintf("memory (re)allocation of %d bytes failed",s));
+ } else {
+ res=xbt_malloc(s);
+ }
+ } else {
+ if (p) {
+ free(p);
+ }
+ }
+ return res;
+}
+#else /* non __GNUC__ */
+# define xbt_strdup(s) strdup(s)
+# define xbt_malloc(n) malloc(n)
+# define xbt_malloc0(n) calloc(n,1)
+# define xbt_realloc(p,s) realloc(p,s)
+#endif /* __GNUC__ ? */