Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to use static variables from inside a non-static inline function.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Nov 2013 11:04:19 +0000 (12:04 +0100)
committerArnaud Giersch <arnaud.giersch@free.fr>
Mon, 4 Nov 2013 12:38:30 +0000 (13:38 +0100)
Clang is a bit picky about this.

src/xbt/dict.c
src/xbt/dict_cursor.c
src/xbt/dynar.c
src/xbt/fifo.c

index be839e3..3984e43 100644 (file)
@@ -171,8 +171,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
   xbt_dictelm_t current, previous = NULL;
   xbt_assert(dict);
 
-  XBT_DEBUG("ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code,
-         dict->table_size, hash_code & dict->table_size);
+  XBT_CDEBUG(xbt_dict,
+             "ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code,
+             dict->table_size, hash_code & dict->table_size);
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
          (hash_code != current->hash_code || key_len != current->key_len
@@ -194,9 +195,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
       previous->next = current;
     }
   } else {
-    XBT_DEBUG("Replace %.*s by %.*s under key %.*s",
-           key_len, (char *) current->content,
-           key_len, (char *) data, key_len, (char *) key);
+    XBT_CDEBUG(xbt_dict, "Replace %.*s by %.*s under key %.*s",
+               key_len, (char *) current->content,
+               key_len, (char *) data, key_len, (char *) key);
     /* there is already an element with the same key: overwrite it */
     xbt_dictelm_set_data(dict, current, data, free_ctn);
   }
index 790536c..c39e65d 100644 (file)
@@ -81,9 +81,9 @@ XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor)
 XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict,
                                       xbt_dict_cursor_t * cursor)
 {
-  XBT_DEBUG("xbt_dict_cursor_first");
+  XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_first");
   if (!*cursor) {
-    XBT_DEBUG("Create the cursor on first use");
+    XBT_CDEBUG(xbt_dict_cursor, "Create the cursor on first use");
     *cursor = xbt_dict_cursor_new(dict);
   } else {
     xbt_dict_cursor_rewind(*cursor);
@@ -102,7 +102,7 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor)
   xbt_dictelm_t current;
   int line;
 
-  XBT_DEBUG("xbt_dict_cursor_step");
+  XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_step");
   xbt_assert(cursor);
 
   current = cursor->current;
@@ -111,17 +111,17 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor)
   if (cursor->dict != NULL) {
 
     if (current != NULL) {
-      XBT_DEBUG("current is not null, take the next element");
+      XBT_CDEBUG(xbt_dict_cursor, "current is not null, take the next element");
       current = current->next;
-      XBT_DEBUG("next element: %p", current);
+      XBT_CDEBUG(xbt_dict_cursor, "next element: %p", current);
     }
 
     while (current == NULL && ++line <= cursor->dict->table_size) {
-      XBT_DEBUG("current is NULL, take the next line");
+      XBT_CDEBUG(xbt_dict_cursor, "current is NULL, take the next line");
       current = cursor->dict->table[line];
-      XBT_DEBUG("element in the next line: %p", current);
+      XBT_CDEBUG(xbt_dict_cursor, "element in the next line: %p", current);
     }
-    XBT_DEBUG("search finished, current = %p, line = %d", current, line);
+    XBT_CDEBUG(xbt_dict_cursor, "search finished, current = %p, line = %d", current, line);
 
     cursor->current = current;
     cursor->line = line;
@@ -139,7 +139,7 @@ XBT_INLINE int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor,
 
   xbt_dictelm_t current;
 
-  XBT_DEBUG("xbt_dict_get_or_free");
+  XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_get_or_free");
 
 
   if (!cursor || !(*cursor))
index d6d4611..d9e20b9 100644 (file)
@@ -149,7 +149,7 @@ XBT_INLINE void xbt_dynar_reset(xbt_dynar_t const dynar)
 {
   _sanity_check_dynar(dynar);
 
-  XBT_DEBUG("Reset the dynar %p", (void *) dynar);
+  XBT_CDEBUG(xbt_dyn, "Reset the dynar %p", (void *) dynar);
   if (dynar->free_f) {
     xbt_dynar_map(dynar, dynar->free_f);
   }
@@ -557,7 +557,7 @@ XBT_INLINE void xbt_dynar_push(xbt_dynar_t const dynar,
 XBT_INLINE void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
 {
   _check_populated_dynar(dynar);
-  XBT_DEBUG("Pop %p", (void *) dynar);
+  XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
   dynar->used--;
   return _xbt_dynar_elm(dynar, dynar->used);
 }
@@ -567,7 +567,7 @@ XBT_INLINE void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst)
 {
 
   /* sanity checks done by remove_at */
-  XBT_DEBUG("Pop %p", (void *) dynar);
+  XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
   xbt_dynar_remove_at(dynar, dynar->used - 1, dst);
 }
 
index e28cc7e..adaa88d 100644 (file)
@@ -429,7 +429,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_new_item(void)
  */
 XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_new_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_new_item.");
   return xbt_fifo_new_item();
 }
 
@@ -469,7 +469,7 @@ XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b)
  */
 XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t b)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_free_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_free_item.");
   xbt_fifo_free_item(b);
   return;
 }
@@ -509,7 +509,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l)
  */
 XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_get_first_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_first_item.");
   return xbt_fifo_get_first_item(l);
 }
 
@@ -530,7 +530,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i)
  */
 xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_get_next_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_next_item.");
   return xbt_fifo_get_next_item(i);
 }