Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't depend on <stdbool.h>.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 5 Apr 2018 07:20:34 +0000 (09:20 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 5 Apr 2018 07:27:33 +0000 (09:27 +0200)
It's inclusion in xbt/base.h breaks existing MPI codesi (e.g. AMG2013).

include/xbt/base.h
include/xbt/dynar.h
src/xbt/dict_cursor.c

index 7cb057e..ab3afcd 100644 (file)
 
 #endif
 
 
 #endif
 
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
-
 /* C++ users need love */
 #ifndef SG_BEGIN_DECL
 # ifdef __cplusplus
 /* C++ users need love */
 #ifndef SG_BEGIN_DECL
 # ifdef __cplusplus
index fee93eb..52a99e0 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 */
 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 0;
 
   if (idx >= dynar->used) {
     //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
 
   if (idx >= dynar->used) {
     //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
-    return false;
+    return 0;
   }
   //  XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
 
   memcpy(dst, ((char *) dynar->data) + idx * dynar->elmsize, dynar->elmsize);
 
   }
   //  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 1;
 }
 
 /** @brief Iterates over the whole dynar.
 }
 
 /** @brief Iterates over the whole dynar.
index 9959a34..f6b6a3d 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))
   XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_get_or_free");
 
   if (!cursor || !(*cursor))
-    return false;
+    return 0;
 
   current = (*cursor)->current;
   if (current == NULL) {        /* no data left */
     xbt_dict_cursor_free(cursor);
 
   current = (*cursor)->current;
   if (current == NULL) {        /* no data left */
     xbt_dict_cursor_free(cursor);
-    return false;
+    return 0;
   }
 
   *key = current->key;
   *data = current->content;
   }
 
   *key = current->key;
   *data = current->content;
-  return true;
+  return 1;
 }
 
 /**
 }
 
 /**