From: alegrand Date: Wed, 2 Apr 2008 16:32:16 +0000 (+0000) Subject: Bug Fix. This function used to return the last task of the list when no matching... X-Git-Tag: v3.3~564 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b13a2e5f15ba5daa7f5ae404476b992e19df2244 Bug Fix. This function used to return the last task of the list when no matching task was found. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5323 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index aadc18fda0..8b29ed148c 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -102,22 +102,20 @@ MSG_mailbox_get_head(msg_mailbox_t mailbox) return (m_task_t)xbt_fifo_get_item_content(item); } + m_task_t MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host) { - m_task_t task = NULL; - xbt_fifo_item_t item = NULL; - - xbt_fifo_foreach(mailbox->tasks, item, task, m_task_t) - { - if (task->simdata->source == host) - break; - } - - if(item) - xbt_fifo_remove_item(mailbox->tasks, item); - - return task; + m_task_t task = NULL; + xbt_fifo_item_t item = NULL; + + xbt_fifo_foreach(mailbox->tasks, item, task, m_task_t) + if (task->simdata->source == host) { + xbt_fifo_remove_item(mailbox->tasks, item); + return task; + } + + return NULL; } int