From cd1b6fc186f641dd5e3fb68d793c6253e1b8fcd9 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 23 Apr 2016 15:32:06 +0200 Subject: [PATCH] We never use the name of the mailbox --- include/simgrid/s4u/mailbox.hpp | 7 ++++--- src/s4u/s4u_mailbox.cpp | 4 ---- src/simix/smx_network.cpp | 4 +--- src/simix/smx_network_private.h | 1 - 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/simgrid/s4u/mailbox.hpp b/include/simgrid/s4u/mailbox.hpp index b30bdfeb35..5914a41065 100644 --- a/include/simgrid/s4u/mailbox.hpp +++ b/include/simgrid/s4u/mailbox.hpp @@ -3,6 +3,8 @@ /* 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. */ +#ifdef __cplusplus + #ifndef SIMGRID_S4U_MAILBOX_HPP #define SIMGRID_S4U_MAILBOX_HPP @@ -34,16 +36,15 @@ protected: smx_mailbox_t getInferior() { return inferior_; } public: - /** Get the name of that mailbox */ - const char *getName(); /** Retrieve the mailbox associated to the given string */ static Mailbox *byName(const char *name); private: - std::string name_; smx_mailbox_t inferior_; static boost::unordered_map *mailboxes; }; }} // namespace simgrid::s4u +#endif + #endif /* SIMGRID_S4U_MAILBOX_HPP */ diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index b2afd59b4a..3b8c0ba51d 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -20,12 +20,8 @@ boost::unordered_map *s4u::Mailbox::mailboxes = ne s4u::Mailbox::Mailbox(const char*name, smx_mailbox_t inferior) { inferior_ = inferior; - name_ = name; mailboxes->insert({name, this}); } -const char *s4u::Mailbox::getName() { - return name_.c_str(); -} s4u::Mailbox *s4u::Mailbox::byName(const char*name) { s4u::Mailbox *res; try { diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index dcf2c73eb2..724dc20202 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -41,13 +41,12 @@ smx_mailbox_t SIMIX_mbox_create(const char *name) if (!mbox) { mbox = xbt_new0(s_smx_mailbox_t, 1); - mbox->name = xbt_strdup(name); mbox->comm_queue = new std::deque(); mbox->done_comm_queue = nullptr; // Allocated on need only mbox->permanent_receiver=NULL; XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name); - xbt_dict_set(mailboxes, mbox->name, mbox, NULL); + xbt_dict_set(mailboxes, name, mbox, NULL); } return mbox; } @@ -56,7 +55,6 @@ void SIMIX_mbox_free(void *data) { XBT_DEBUG("mbox free %p", data); smx_mailbox_t mbox = (smx_mailbox_t) data; - xbt_free(mbox->name); delete mbox->comm_queue; delete mbox->done_comm_queue; diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index cc6e381ec2..5c6adf8185 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -15,7 +15,6 @@ /** @brief Rendez-vous point datatype */ typedef struct s_smx_mailbox { - char *name; std::deque *comm_queue; void *data; smx_process_t permanent_receiver; //process which the mailbox is attached to -- 2.20.1