XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_fifo, xbt, "FIFO");
static void *fifo_item_mallocator_new_f(void);
-static void fifo_item_mallocator_free_f(void *item);
+#define fifo_item_mallocator_free_f xbt_free_f
static void fifo_item_mallocator_reset_f(void *item);
static xbt_mallocator_t item_mallocator = NULL;
return xbt_new(s_xbt_fifo_item_t, 1);
}
-static void fifo_item_mallocator_free_f(void *item)
-{
- xbt_free(item);
-}
-
static void fifo_item_mallocator_reset_f(void *item)
{
/* memset to zero like calloc */
/** Constructor
* \return a new bucket
*/
-xbt_fifo_item_t xbt_fifo_new_item(void)
+XBT_INLINE xbt_fifo_item_t xbt_fifo_new_item(void)
{
return xbt_mallocator_get(item_mallocator);
}
*
* Free the bucket but does not modifies the object (if any) that was stored in it.
*/
-void xbt_fifo_free_item(xbt_fifo_item_t b)
+XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b)
{
xbt_mallocator_release(item_mallocator, b);
return;
/**
* \param l a list
* \return the head of \a l.
+ *
+ * Returns NULL if the list is empty.
*/
-xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l)
+XBT_INLINE xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l)
{
return l->head;
}
/**
* \param l a list
* \return the tail of \a l.
+ *
+ * Returns NULL if the list is empty.
*/
-xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l)
+XBT_INLINE xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l)
{
return l->tail;
}
/**
* \param i a bucket
* \return the bucket that comes next
+ *
+ * Returns NULL if \a i is the tail of the list.
*/
XBT_INLINE xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i)
{
/**
* \param i a bucket
* \return the bucket that is just before \a i.
+ *
+ * Returns NULL if \a i is the head of the list.
*/
XBT_INLINE xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i)
{