Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
We never use the name of the mailbox
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 23 Apr 2016 13:32:06 +0000 (15:32 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 23 Apr 2016 20:21:43 +0000 (22:21 +0200)
include/simgrid/s4u/mailbox.hpp
src/s4u/s4u_mailbox.cpp
src/simix/smx_network.cpp
src/simix/smx_network_private.h

index b30bdfe..5914a41 100644 (file)
@@ -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. */
 
 /* 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
 
 #ifndef SIMGRID_S4U_MAILBOX_HPP
 #define SIMGRID_S4U_MAILBOX_HPP
 
@@ -34,16 +36,15 @@ protected:
   smx_mailbox_t getInferior() { return inferior_; }
 
 public:
   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:
   /** 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<std::string, Mailbox *> *mailboxes;
 };
 }} // namespace simgrid::s4u
 
   smx_mailbox_t inferior_;
   static boost::unordered_map<std::string, Mailbox *> *mailboxes;
 };
 }} // namespace simgrid::s4u
 
+#endif
+
 #endif /* SIMGRID_S4U_MAILBOX_HPP */
 #endif /* SIMGRID_S4U_MAILBOX_HPP */
index b2afd59..3b8c0ba 100644 (file)
@@ -20,12 +20,8 @@ boost::unordered_map <std::string, s4u::Mailbox *> *s4u::Mailbox::mailboxes = ne
 
 s4u::Mailbox::Mailbox(const char*name, smx_mailbox_t inferior) {
   inferior_ = inferior;
 
 s4u::Mailbox::Mailbox(const char*name, smx_mailbox_t inferior) {
   inferior_ = inferior;
-  name_ = name;
   mailboxes->insert({name, this});
 }
   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 {
 s4u::Mailbox *s4u::Mailbox::byName(const char*name) {
   s4u::Mailbox *res;
   try {
index dcf2c73..724dc20 100644 (file)
@@ -41,13 +41,12 @@ smx_mailbox_t SIMIX_mbox_create(const char *name)
 
   if (!mbox) {
     mbox = xbt_new0(s_smx_mailbox_t, 1);
 
   if (!mbox) {
     mbox = xbt_new0(s_smx_mailbox_t, 1);
-    mbox->name = xbt_strdup(name);
     mbox->comm_queue = new std::deque<smx_synchro_t>();
     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);
     mbox->comm_queue = new std::deque<smx_synchro_t>();
     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;
 }
   }
   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_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;
 
   delete mbox->comm_queue;
   delete mbox->done_comm_queue;
 
index cc6e381..5c6adf8 100644 (file)
@@ -15,7 +15,6 @@
 
 /** @brief Rendez-vous point datatype */
 typedef struct s_smx_mailbox {
 
 /** @brief Rendez-vous point datatype */
 typedef struct s_smx_mailbox {
-  char *name;
   std::deque<smx_synchro_t> *comm_queue;
   void *data;
   smx_process_t permanent_receiver; //process which the mailbox is attached to
   std::deque<smx_synchro_t> *comm_queue;
   void *data;
   smx_process_t permanent_receiver; //process which the mailbox is attached to