X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/24b8008bb424160e633b1374f54dcd89bdcb9749..509afa8dafbfc8a505586e5447a1ed4c76cf0ae3:/src/xbt/fifo.c diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index cb50c60391..d83903296b 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -1,7 +1,9 @@ -/* Authors: Arnaud Legrand */ +/* $Id$ */ + +/* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - under the terms of the license (GNU LGPL) which comes with this package. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/sysdep.h" #include "xbt/error.h" @@ -56,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); @@ -87,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; @@ -306,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; +} +