X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/46e229fc1c826e4c0561cc2386a7c307e2b0b9e9..de8cfa17c0e30bf9dccf0b0c9ecaff7858926f04:/include/xbt/sysdep.h diff --git a/include/xbt/sysdep.h b/include/xbt/sysdep.h index 9ed7c53e13..d990aaa0e9 100644 --- a/include/xbt/sysdep.h +++ b/include/xbt/sysdep.h @@ -71,11 +71,8 @@ XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2); * @{ */ -#if defined(__GNUC__) || defined(DOXYGEN) /** @brief Like strdup, but xbt_die() on error */ -static inline __attribute__ ((always_inline)) -char *xbt_strdup(const char *s) -{ +static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) { char *res = NULL; if (s) { res = strdup(s); @@ -89,9 +86,7 @@ XBT_PUBLIC(void) xbt_backtrace_display_current(void); /** @brief Like malloc, but xbt_die() on error @hideinitializer */ -static inline __attribute__ ((always_inline)) -void *xbt_malloc(size_t n) -{ +static XBT_ALWAYS_INLINE void *xbt_malloc(size_t n) { void *res; /* if (n==0) { xbt_backtrace_display_current(); @@ -106,9 +101,7 @@ void *xbt_malloc(size_t n) /** @brief like malloc, but xbt_die() on error and memset data to 0 @hideinitializer */ -static inline __attribute__ ((always_inline)) -void *xbt_malloc0(size_t n) -{ +static XBT_ALWAYS_INLINE void *xbt_malloc0(size_t n) { void *res; //if (n==0) xbt_die("calloc(0) is not portable"); res = calloc(n, 1); @@ -119,9 +112,7 @@ void *xbt_malloc0(size_t n) /** @brief like realloc, but xbt_die() on error @hideinitializer */ -static inline __attribute__ ((always_inline)) -void *xbt_realloc(void *p, size_t s) -{ +static XBT_ALWAYS_INLINE void *xbt_realloc(void *p, size_t s) { void *res = NULL; //if (s==0) xbt_die("realloc(0) is not portable"); if (s) { @@ -137,12 +128,6 @@ void *xbt_realloc(void *p, size_t s) } 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__ ? */ /** @brief like free @hideinitializer */