Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use <stdbool.h> for C files.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 28 Mar 2018 12:00:54 +0000 (14:00 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 28 Mar 2018 12:00:54 +0000 (14:00 +0200)
include/xbt/base.h
include/xbt/dynar.h
src/xbt/dict_cursor.c

index 14aad80..7cb057e 100644 (file)
 
 #endif
 
-#define TRUE  1
-#define FALSE 0
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
 
 /* C++ users need love */
 #ifndef SG_BEGIN_DECL
index 89e9597..fee93eb 100644 (file)
@@ -208,17 +208,17 @@ typedef struct xbt_dynar_s {
 static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void* const dst)
 {
   if (!dynar) /* iterating over a NULL dynar is a no-op */
-    return FALSE;
+    return false;
 
   if (idx >= dynar->used) {
     //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
-    return FALSE;
+    return false;
   }
   //  XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
 
   memcpy(dst, ((char *) dynar->data) + idx * dynar->elmsize, dynar->elmsize);
 
-  return TRUE;
+  return true;
 }
 
 /** @brief Iterates over the whole dynar.
index 6ccf21c..6c8d2a5 100644 (file)
@@ -128,17 +128,17 @@ inline int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, char **key, v
   XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_get_or_free");
 
   if (!cursor || !(*cursor))
-    return FALSE;
+    return false;
 
   current = (*cursor)->current;
   if (current == NULL) {        /* no data left */
     xbt_dict_cursor_free(cursor);
-    return FALSE;
+    return false;
   }
 
   *key = current->key;
   *data = current->content;
-  return TRUE;
+  return true;
 }
 
 /**