Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
doxygenification
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sun, 13 Feb 2005 23:32:26 +0000 (23:32 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sun, 13 Feb 2005 23:32:26 +0000 (23:32 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1015 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/xbt/sysdep.h

index a96b1b2..1807756 100644 (file)
    
 #include "xbt/misc.h"
 BEGIN_DECL()
    
 #include "xbt/misc.h"
 BEGIN_DECL()
-#if 0
-#define __CALLOC_OP(n, s)  calloc((n), (s))
-  #define __REALLOC_OP(n, s)  realloc((n), (s))
-#define CALLOC(n, s)  ((__CALLOC_OP  ((n)?:(FAILURE("attempt to alloc 0 bytes"), 0), (s)?:(FAILURE("attempt to alloc 0 bytes"), 0)))?:(FAILURE("memory allocation error"), NULL))
-  /* #define REALLOC(p, s) ((__REALLOC_OP ((p), (s)?:(FAILURE("attempt to alloc 0 bytes"), 0)))?:(FAILURE("memory reallocation error"), NULL)) */
-  #define REALLOC(p, s) (__REALLOC_OP ((p), (s)))
-#endif
-  
+
+/** @addtogroup XBT_syscall
+ *  @{
+ */
+
+/** @brief like strdup, but xbt_die() on error 
+    @hideinitializer */
 #define xbt_strdup(s)  ((s)?(strdup(s)?:(xbt_die("memory allocation error"),NULL))\
                            :(NULL))
 #define xbt_strdup(s)  ((s)?(strdup(s)?:(xbt_die("memory allocation error"),NULL))\
                            :(NULL))
+/** @brief like malloc, but xbt_die() on error 
+    @hideinitializer */
 #define xbt_malloc(n)   (malloc(n) ?: (xbt_die("memory allocation error"),NULL))
 #define xbt_malloc(n)   (malloc(n) ?: (xbt_die("memory allocation error"),NULL))
+
+/** @brief like malloc, but xbt_die() on error and memset data to 0
+    @hideinitializer */
 #define xbt_malloc0(n)  (calloc( (n),1 ) ?: (xbt_die("memory allocation error"),NULL))
 #define xbt_malloc0(n)  (calloc( (n),1 ) ?: (xbt_die("memory allocation error"),NULL))
+  
+/** @brief like realloc, but xbt_die() on error 
+    @hideinitializer */
 #define xbt_realloc(p,s) (s? (p? (realloc(p,s)?:(xbt_die("memory allocation error"),NULL)) \
                                : xbt_malloc(s)) \
                            : (p? (free(p),NULL) \
                                : NULL))
 #define xbt_realloc(p,s) (s? (p? (realloc(p,s)?:(xbt_die("memory allocation error"),NULL)) \
                                : xbt_malloc(s)) \
                            : (p? (free(p),NULL) \
                                : NULL))
+/** @brief like free
+    @hideinitializer */
 #define xbt_free free /*nothing specific to do here. A poor valgrind replacement?*/
 #define xbt_free free /*nothing specific to do here. A poor valgrind replacement?*/
-#define xbt_free_fct free /* replacement with the guareenty of being a function */
+/*#define xbt_free_fct free * replacement with the guareenty of being a function  FIXME:KILLME*/
    
    
+/** @brief like calloc, but xbt_die() on error and don't memset to 0
+    @hideinitializer */
 #define xbt_new(type, count)  ((type*)xbt_malloc (sizeof (type) * (count)))
 #define xbt_new(type, count)  ((type*)xbt_malloc (sizeof (type) * (count)))
+/** @brief like calloc, but xbt_die() on error
+    @hideinitializer */
 #define xbt_new0(type, count) ((type*)xbt_malloc0 (sizeof (type) * (count)))
 
 #define xbt_new0(type, count) ((type*)xbt_malloc0 (sizeof (type) * (count)))
 
+/** @} */
+  
 /* Attributes are only in recent versions of GCC */
 /* Attributes are only in recent versions of GCC */
-
 #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
 # define _XBT_GNUC_PRINTF( format_idx, arg_idx )    \
           __attribute__((__format__ (__printf__, format_idx, arg_idx)))
 #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
 # define _XBT_GNUC_PRINTF( format_idx, arg_idx )    \
           __attribute__((__format__ (__printf__, format_idx, arg_idx)))