From e8e56674c26143be19972c3ad447852af67a9a79 Mon Sep 17 00:00:00 2001 From: mquinson Date: Sat, 27 Oct 2007 08:36:33 +0000 Subject: [PATCH] Kill code duplication, and doc tiny improvements git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4898 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/msg/host.c | 4 +-- src/msg/m_process.c | 68 +++++++++++-------------------------- src/simdag/sd_link.c | 6 ++-- src/simdag/sd_workstation.c | 6 ++-- 4 files changed, 28 insertions(+), 56 deletions(-) diff --git a/src/msg/host.c b/src/msg/host.c index 2b933f9ee0..2b16677908 100644 --- a/src/msg/host.c +++ b/src/msg/host.c @@ -187,11 +187,11 @@ double MSG_get_host_speed(m_host_t h) } /** \ingroup m_host_management - * \brief Returns the value of a certain host property + * \brief Returns the value of a given host property * * \param host a host * \param name a property name - * \return value of a property + * \return value of a property (or NULL if property not set) */ const char* MSG_host_get_property_value(m_host_t host, char* name) { diff --git a/src/msg/m_process.c b/src/msg/m_process.c index 8f3d6d5500..900f4cbc59 100644 --- a/src/msg/m_process.c +++ b/src/msg/m_process.c @@ -29,21 +29,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, */ /******************************** Process ************************************/ -/** \ingroup m_process_management - * \brief Creates and runs a new #m_process_t. - * - * Does exactly the same as #MSG_process_create_with_arguments but without - providing standard arguments (\a argc, \a argv, \a start_time, \a kill_time). - * \sa MSG_process_create_with_arguments - */ -m_process_t MSG_process_create(const char *name, - xbt_main_func_t code, void *data, - m_host_t host) -{ - return MSG_process_create_with_arguments(name, code, data, host, -1, - NULL); -} - void __MSG_process_cleanup(void *arg) { /* arg is a pointer to a simix process, we can get the msg process with the field data */ @@ -69,6 +54,21 @@ void *_MSG_process_create_from_SIMIX(const char *name, argc, argv,properties); } +/** \ingroup m_process_management + * \brief Creates and runs a new #m_process_t. + * + * Does exactly the same as #MSG_process_create_with_arguments but without + providing standard arguments (\a argc, \a argv, \a start_time, \a kill_time). + * \sa MSG_process_create_with_arguments + */ +m_process_t MSG_process_create(const char *name, + xbt_main_func_t code, void *data, + m_host_t host) +{ + return MSG_process_create_with_environment(name, code, data, host, -1, + NULL,NULL); +} + /** \ingroup m_process_management * \brief Creates and runs a new #m_process_t. @@ -99,36 +99,8 @@ m_process_t MSG_process_create_with_arguments(const char *name, void *data, m_host_t host, int argc, char **argv) { - simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1); - m_process_t process = xbt_new0(s_m_process_t, 1); - xbt_assert0(((code != NULL) && (host != NULL)), "Invalid parameters"); - - /* Simulator Data */ - simdata->PID = msg_global->PID++; - simdata->waiting_task = NULL; - simdata->m_host = host; - simdata->argc = argc; - simdata->argv = argv; - simdata->s_process = SIMIX_process_create(name, code, - (void *) process, host->name, - argc, argv, NULL); - - if (SIMIX_process_self()) { - simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data); - } else { - simdata->PPID = -1; - } - simdata->last_errno = MSG_OK; - - - /* Process structure */ - process->name = xbt_strdup(name); - process->simdata = simdata; - process->data = data ; - - xbt_fifo_unshift(msg_global->process_list, process); - - return process; + return MSG_process_create_with_environment(name, code, data, host, + argc,argv,NULL); } /** \ingroup m_process_management @@ -186,7 +158,7 @@ m_process_t MSG_process_create_with_environment(const char *name, /* Process structure */ process->name = xbt_strdup(name); process->simdata = simdata; - process->data = data ; + process->data = data; xbt_fifo_unshift(msg_global->process_list, process); @@ -349,11 +321,11 @@ const char *MSG_process_get_name(m_process_t process) } /** \ingroup m_process_management - * \brief Returns the value of a certain process property + * \brief Returns the value of a given process property * * \param process a process * \param name a property name - * \return value of a property + * \return value of a property (or NULL if the property is not set) */ const char* MSG_process_get_property_value(m_process_t process, char* name) { diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index e9637b592f..4712b06ba4 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -118,11 +118,11 @@ double SD_link_get_current_bandwidth(SD_link_t link) { } /** - * \brief Returns the value of a certain link property + * \brief Returns the value of a given link property * * \param workstation a workstation * \param name a property name - * \return value of a property + * \return value of a property (or NULL if property not set) */ const char* SD_link_get_property_value(SD_link_t link, char* name) { @@ -130,7 +130,7 @@ const char* SD_link_get_property_value(SD_link_t link, char* name) } /** - * \brief Returns a xbt_dynar_t consisting of the list of properties assigned to a link + * \brief Returns a #xbt_dict_t consisting of the list of properties assigned to a link * * \param link a link * \return the dictionary containing the properties associated with the link diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index fab8673af8..fef8cf7552 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -130,11 +130,11 @@ const char* SD_workstation_get_name(SD_workstation_t workstation) { } /** - * \brief Returns the value of a certain workstation property + * \brief Returns the value of a given workstation property * * \param workstation a workstation * \param name a property name - * \return value of a property + * \return value of a property (or NULL if property not set) */ const char* SD_workstation_get_property_value(SD_workstation_t ws, char* name) { @@ -143,7 +143,7 @@ const char* SD_workstation_get_property_value(SD_workstation_t ws, char* name) /** - * \brief Returns a xbt_dynar_t consisting of the list of properties assigned to this workstation + * \brief Returns a #xbt_dict_t consisting of the list of properties assigned to this workstation * * \param workstation a workstation * \return the dictionary containing the properties associated with the workstation -- 2.20.1