X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d99d3238efb76357fcc6437c15fb900c3c02ebd4..596294ab8f7a06cf75114739b574a013b60bb368:/src/simix/smx_network.cpp diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index b1cf01d19a..94df88e3e0 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -40,30 +40,23 @@ void SIMIX_mailbox_exit(void) smx_mailbox_t SIMIX_mbox_create(const char *name) { + xbt_assert(name, "Mailboxes must have a name"); /* two processes may have pushed the same mbox_create simcall at the same time */ - smx_mailbox_t mbox = name ? (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name) : NULL; + smx_mailbox_t mbox = (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name); if (!mbox) { mbox = xbt_new0(s_smx_mailbox_t, 1); - mbox->name = name ? xbt_strdup(name) : NULL; + mbox->name = xbt_strdup(name); mbox->comm_fifo = xbt_fifo_new(); mbox->done_comm_fifo = xbt_fifo_new(); mbox->permanent_receiver=NULL; XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name); - - if (mbox->name) - xbt_dict_set(mailboxes, mbox->name, mbox, NULL); + xbt_dict_set(mailboxes, mbox->name, mbox, NULL); } return mbox; } -void SIMIX_mbox_destroy(smx_mailbox_t mbox) -{ - if (mbox->name) - xbt_dict_remove(mailboxes, mbox->name); -} - void SIMIX_mbox_free(void *data) { XBT_DEBUG("mbox free %p", data);