Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I probably had been drinking too much the day I have written this command... Sorry...
[simgrid.git] / src / xbt / fifo.c
index b71e213..d839032 100644 (file)
@@ -58,8 +58,8 @@ void *xbt_fifo_pop(xbt_fifo_t l)
   xbt_fifo_item_t item;
   void *content;
 
-  item = xbt_fifo_pop_item(l);
-  if(item==NULL) return NULL;
+  if(l==NULL) return NULL;
+  if(!(item = xbt_fifo_pop_item(l))) return NULL;
 
   content = item->content;
   xbt_fifo_freeitem(item);
@@ -89,9 +89,9 @@ void *xbt_fifo_shift(xbt_fifo_t l)
   xbt_fifo_item_t item;
   void *content;
 
-  item = xbt_fifo_shift_item(l);
   if(l==NULL) return NULL;
-
+  if(!(item = xbt_fifo_shift_item(l))) return NULL;
+  
   content = item->content;
   xbt_fifo_freeitem(item);
   return content;
@@ -308,4 +308,21 @@ int xbt_fifo_size(xbt_fifo_t f)
   return f->count;
 }
 
+xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
+{
+  return l->head;
+}
+
+xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i)
+{
+  if(i) return i->next;
+  return NULL;
+}
+
+xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i)
+{
+  if(i) return i->prev;
+  return NULL;
+}
+