From 9b757886241c3fc8c055842b3cf7fef7494031d7 Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 20 Nov 2009 11:50:32 +0000 Subject: [PATCH] Mark a bunch of functions as candidates to inlining. Not quite sure that gcc does it, yet git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6849 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- include/xbt/misc.h | 10 ++-------- src/simix/smx_action.c | 20 ++++++++++---------- src/simix/smx_deployment.c | 2 +- src/simix/smx_global.c | 14 +++++++------- src/simix/smx_host.c | 22 +++++++++++----------- src/simix/smx_network.c | 20 ++++++++++---------- src/simix/smx_process.c | 18 +++++++++--------- src/simix/smx_synchro.c | 8 ++++---- src/surf/maxmin.c | 30 +++++++++++++++--------------- src/surf/maxmin_private.h | 2 +- src/surf/surf_action.c | 10 +++++----- src/surf/surf_private.h | 8 ++++---- src/surf/trace_mgr.c | 10 +++++----- src/xbt/dict.c | 16 ++++++++-------- src/xbt/dict_cursor.c | 18 ++++++++---------- src/xbt/dynar.c | 32 ++++++++++++++++---------------- src/xbt/fifo.c | 22 +++++++++++----------- src/xbt/heap.c | 8 ++++---- src/xbt/swag.c | 8 ++++---- src/xbt/xbt_strbuff.c | 12 ++++++------ 20 files changed, 141 insertions(+), 149 deletions(-) diff --git a/include/xbt/misc.h b/include/xbt/misc.h index 4a9836e4f9..4f0d04787c 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -155,15 +155,9 @@ # define XBT_IMPORT_NO_EXPORT(type) __declspec(dllimport) type # define XBT_PUBLIC_DATA(type) __declspec(dllimport) type -/* UNIX build. If compiling in supernovae, try to inline everything */ -#elif defined(SUPERNOVAE_MODE) -# define XBT_PUBLIC(type) inline type -# define XBT_EXPORT_NO_IMPORT(type) type -# define XBT_IMPORT_NO_EXPORT(type) type -# define XBT_PUBLIC_DATA(type) extern type -/* UNIX sain build... */ +/* UNIX build. Mark all functions as [potentially] inline, in case we are compiling in supernovae */ #else -# define XBT_PUBLIC(type) extern type +# define XBT_PUBLIC(type) XBT_INLINE type # define XBT_EXPORT_NO_IMPORT(type) type # define XBT_IMPORT_NO_EXPORT(type) type # define XBT_PUBLIC_DATA(type) extern type diff --git a/src/simix/smx_action.c b/src/simix/smx_action.c index 0f8221251e..ab885c7f47 100644 --- a/src/simix/smx_action.c +++ b/src/simix/smx_action.c @@ -147,7 +147,7 @@ smx_action_t SIMIX_action_sleep(smx_host_t host, double duration) * This functions stops the execution of an action. It calls a surf functions. * \param action The SIMIX action */ -void SIMIX_action_cancel(smx_action_t action) +XBT_INLINE void SIMIX_action_cancel(smx_action_t action) { xbt_assert0((action != NULL), "Invalid parameter"); @@ -165,7 +165,7 @@ void SIMIX_action_cancel(smx_action_t action) * \param action The SIMIX action * \param priority The new priority */ -void SIMIX_action_set_priority(smx_action_t action, double priority) +XBT_INLINE void SIMIX_action_set_priority(smx_action_t action, double priority) { xbt_assert0((action != NULL), "Invalid parameter"); @@ -215,7 +215,7 @@ int SIMIX_action_destroy(smx_action_t action) * * \param action The SIMIX action */ -void SIMIX_action_use(smx_action_t action) +XBT_INLINE void SIMIX_action_use(smx_action_t action) { XBT_IN3("(%p:'%s',%d)", action, action->name, action->refcount); xbt_assert0((action != NULL), "Invalid parameter"); @@ -230,7 +230,7 @@ void SIMIX_action_use(smx_action_t action) * * \param action The SIMIX action */ -void SIMIX_action_release(smx_action_t action) +XBT_INLINE void SIMIX_action_release(smx_action_t action) { xbt_assert0((action != NULL), "Invalid parameter"); @@ -303,7 +303,7 @@ void SIMIX_unregister_action_to_condition(smx_action_t action, * * When the action terminates, the semaphore gets signaled automatically. */ -void SIMIX_register_action_to_semaphore(smx_action_t action, smx_sem_t sem) { +XBT_INLINE void SIMIX_register_action_to_semaphore(smx_action_t action, smx_sem_t sem) { DEBUG2("Register action %p to semaphore %p (and otherwise)", action, sem); xbt_fifo_push(sem->actions, action); @@ -314,7 +314,7 @@ void SIMIX_register_action_to_semaphore(smx_action_t action, smx_sem_t sem) { * * Destroys the "links" from the semaphore to this action. */ -void SIMIX_unregister_action_to_semaphore(smx_action_t action, +XBT_INLINE void SIMIX_unregister_action_to_semaphore(smx_action_t action, smx_sem_t sem) { xbt_fifo_remove_all(sem->actions, action); @@ -327,7 +327,7 @@ void SIMIX_unregister_action_to_semaphore(smx_action_t action, * \param action The SIMIX action * \return Remains cost */ -double SIMIX_action_get_remains(smx_action_t action) +XBT_INLINE double SIMIX_action_get_remains(smx_action_t action) { xbt_assert0((action != NULL), "Invalid parameter"); return surf_workstation_model->get_remains(action->surf_action); @@ -367,7 +367,7 @@ smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb, return act; } -e_surf_action_state_t SIMIX_action_get_state(smx_action_t action) +XBT_INLINE e_surf_action_state_t SIMIX_action_get_state(smx_action_t action) { xbt_assert0((action != NULL), "Invalid parameter"); return surf_workstation_model->action_state_get(action->surf_action); @@ -393,13 +393,13 @@ void __SIMIX_action_display_conditions(smx_action_t action) DEBUG1("\t %p", cond); } -char *SIMIX_action_get_name(smx_action_t action) +XBT_INLINE char *SIMIX_action_get_name(smx_action_t action) { xbt_assert0((action != NULL), "Invalid parameter"); return action->name; } /** @brief Change the name of the action. Warning, the string you provide is not strdup()ed */ -void SIMIX_action_set_name(smx_action_t action,char *name) +XBT_INLINE void SIMIX_action_set_name(smx_action_t action,char *name) { xbt_free(action->name); action->name = name; diff --git a/src/simix/smx_deployment.c b/src/simix/smx_deployment.c index cd3d2afad5..36a1a1da50 100644 --- a/src/simix/smx_deployment.c +++ b/src/simix/smx_deployment.c @@ -143,7 +143,7 @@ void SIMIX_launch_application(const char *file) * \param name the reference name of the function. * \param code the function */ -void SIMIX_function_register(const char *name, xbt_main_func_t code) +XBT_INLINE void SIMIX_function_register(const char *name, xbt_main_func_t code) { xbt_assert0(simix_global, "SIMIX_global_init has to be called before SIMIX_function_register."); diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 26e0c5e11d..6daaf17e82 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -267,7 +267,7 @@ void SIMIX_clean(void) * * \return Return the clock. */ -double SIMIX_get_clock(void) +XBT_INLINE double SIMIX_get_clock(void) { return surf_get_clock(); } @@ -277,7 +277,7 @@ double SIMIX_get_clock(void) * * Must be called before the first call to SIMIX_solve() */ -void SIMIX_init(void) +XBT_INLINE void SIMIX_init(void) { surf_presolve(); } @@ -454,12 +454,12 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed) * \param arg Parameters of the function * */ -void SIMIX_timer_set(double date, void *function, void *arg) +XBT_INLINE void SIMIX_timer_set(double date, void *function, void *arg) { surf_timer_model->extension.timer.set(date, function, arg); } -int SIMIX_timer_get(void **function, void **arg) +XBT_INLINE int SIMIX_timer_get(void **function, void **arg) { return surf_timer_model->extension.timer.get(function, arg); } @@ -471,7 +471,7 @@ int SIMIX_timer_get(void **function, void **arg) * \param function Create process function * */ -void SIMIX_function_register_process_create(smx_creation_func_t function) +XBT_INLINE void SIMIX_function_register_process_create(smx_creation_func_t function) { xbt_assert0((simix_global->create_process_function == NULL), "Data already set"); @@ -486,7 +486,7 @@ void SIMIX_function_register_process_create(smx_creation_func_t function) * \param function Kill process function * */ -void SIMIX_function_register_process_kill(void_f_pvoid_t function) +XBT_INLINE void SIMIX_function_register_process_kill(void_f_pvoid_t function) { xbt_assert0((simix_global->kill_process_function == NULL), "Data already set"); @@ -501,7 +501,7 @@ void SIMIX_function_register_process_kill(void_f_pvoid_t function) * \param function cleanup process function * */ -void SIMIX_function_register_process_cleanup(void_f_pvoid_t function) +XBT_INLINE void SIMIX_function_register_process_cleanup(void_f_pvoid_t function) { simix_global->cleanup_process_function = function; } diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 35aceebf3e..b1fc9ae2ed 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -41,7 +41,7 @@ smx_host_t __SIMIX_host_create(const char *name, * \param data User data * */ -void SIMIX_host_set_data(smx_host_t host, void *data) +XBT_INLINE void SIMIX_host_set_data(smx_host_t host, void *data) { xbt_assert0((host != NULL), "Invalid parameters"); xbt_assert0((host->data == NULL), "Data already set"); @@ -58,7 +58,7 @@ void SIMIX_host_set_data(smx_host_t host, void *data) * This functions checks whether \a host is a valid pointer or not and return the user data associated to \a host if it is possible. * \param host SIMIX host */ -void *SIMIX_host_get_data(smx_host_t host) +XBT_INLINE void *SIMIX_host_get_data(smx_host_t host) { xbt_assert0((host != NULL), "Invalid parameters"); @@ -72,7 +72,7 @@ void *SIMIX_host_get_data(smx_host_t host) * This functions checks whether \a host is a valid pointer or not and return its name. * \param host SIMIX host */ -const char *SIMIX_host_get_name(smx_host_t host) +XBT_INLINE const char *SIMIX_host_get_name(smx_host_t host) { xbt_assert0((host != NULL), "Invalid parameters"); @@ -87,7 +87,7 @@ const char *SIMIX_host_get_name(smx_host_t host) * Return the host, more details in #SIMIX_process_get_host * \return SIMIX host */ -smx_host_t SIMIX_host_self(void) +XBT_INLINE smx_host_t SIMIX_host_self(void) { return SIMIX_process_get_host(SIMIX_process_self()); } @@ -131,7 +131,7 @@ void __SIMIX_host_destroy(void *h) * * \return Number of hosts */ -int SIMIX_host_get_number(void) +XBT_INLINE int SIMIX_host_get_number(void) { return (xbt_dict_size(simix_global->host)); } @@ -161,7 +161,7 @@ smx_host_t *SIMIX_host_get_table(void) * * \return List of all hosts (as a #xbt_dict_t) */ -xbt_dict_t SIMIX_host_get_dict(void) +XBT_INLINE xbt_dict_t SIMIX_host_get_dict(void) { return simix_global->host; } @@ -173,7 +173,7 @@ xbt_dict_t SIMIX_host_get_dict(void) * \param host SIMIX host * \return Speed */ -double SIMIX_host_get_speed(smx_host_t host) +XBT_INLINE double SIMIX_host_get_speed(smx_host_t host) { xbt_assert0((host != NULL), "Invalid parameters"); @@ -187,7 +187,7 @@ double SIMIX_host_get_speed(smx_host_t host) * Return the available speed (in Mflop/s). * \return Speed */ -double SIMIX_host_get_available_speed(smx_host_t host) +XBT_INLINE double SIMIX_host_get_available_speed(smx_host_t host) { xbt_assert0((host != NULL), "Invalid parameters"); @@ -202,7 +202,7 @@ double SIMIX_host_get_available_speed(smx_host_t host) * \param name The name of an host. * \return The corresponding host */ -smx_host_t SIMIX_host_get_by_name(const char *name) +XBT_INLINE smx_host_t SIMIX_host_get_by_name(const char *name) { xbt_assert0(((simix_global != NULL) && (simix_global->host != NULL)), "Environment not set yet"); @@ -216,7 +216,7 @@ smx_host_t SIMIX_host_get_by_name(const char *name) * \param host a host * \return the dynamic array consisting of property names */ -xbt_dict_t SIMIX_host_get_properties(smx_host_t host) +XBT_INLINE xbt_dict_t SIMIX_host_get_properties(smx_host_t host) { xbt_assert0((host != NULL), "Invalid parameters"); @@ -231,7 +231,7 @@ xbt_dict_t SIMIX_host_get_properties(smx_host_t host) * \param host The SIMIX host * \return 1 if host is available or 0 if not. */ -int SIMIX_host_get_state(smx_host_t host) +XBT_INLINE int SIMIX_host_get_state(smx_host_t host) { xbt_assert0((host != NULL), "Invalid parameters"); diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 7008ec30fe..40face355c 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -118,17 +118,17 @@ SIMIX_rdv_get_count_waiting_comm(smx_rdv_t rdv, smx_host_t host) * \param rdv The rendez-vous point * \return The communication or NULL if empty */ -smx_comm_t SIMIX_rdv_get_head(smx_rdv_t rdv) +XBT_INLINE smx_comm_t SIMIX_rdv_get_head(smx_rdv_t rdv) { return (smx_comm_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(rdv->comm_fifo)); } /** @brief adds some API-related data to the rendez-vous point */ -void SIMIX_rdv_set_data(smx_rdv_t rdv,void *data) { +XBT_INLINE void SIMIX_rdv_set_data(smx_rdv_t rdv,void *data) { rdv->data=data; } /** @brief gets API-related data from the rendez-vous point */ -void *SIMIX_rdv_get_data(smx_rdv_t rdv) { +XBT_INLINE void *SIMIX_rdv_get_data(smx_rdv_t rdv) { return rdv->data; } @@ -280,7 +280,7 @@ static inline void SIMIX_communication_wait_for_completion(smx_comm_t comm, doub * \brief Cancels a communication * \brief comm The communication to cancel */ -void SIMIX_communication_cancel(smx_comm_t comm) +XBT_INLINE void SIMIX_communication_cancel(smx_comm_t comm) { SIMIX_action_cancel(comm->act); } @@ -289,7 +289,7 @@ void SIMIX_communication_cancel(smx_comm_t comm) * \brief get the amount remaining from the communication * \param comm The communication */ -double SIMIX_communication_get_remains(smx_comm_t comm) +XBT_INLINE double SIMIX_communication_get_remains(smx_comm_t comm) { return SIMIX_action_get_remains(comm->act); } @@ -329,7 +329,7 @@ void SIMIX_network_copy_data(smx_comm_t comm) * \param comm The communication * \return the user data */ -void *SIMIX_communication_get_data(smx_comm_t comm) +XBT_INLINE void *SIMIX_communication_get_data(smx_comm_t comm) { return comm->data; } @@ -353,7 +353,7 @@ void *SIMIX_communication_get_data(smx_comm_t comm) * - timeout_error if communication reached the timeout specified * - network_error if network failed or peer issued a timeout */ -void SIMIX_network_send(smx_rdv_t rdv, double task_size, double rate, +XBT_INLINE void SIMIX_network_send(smx_rdv_t rdv, double task_size, double rate, double timeout, void *src_buff, size_t src_buff_size, smx_comm_t *comm_ref, void *data) { @@ -374,7 +374,7 @@ void SIMIX_network_send(smx_rdv_t rdv, double task_size, double rate, * - timeout_error if communication reached the timeout specified * - network_error if network failed or peer issued a timeout */ -void SIMIX_network_recv(smx_rdv_t rdv, double timeout, void *dst_buff, +XBT_INLINE void SIMIX_network_recv(smx_rdv_t rdv, double timeout, void *dst_buff, size_t *dst_buff_size, smx_comm_t *comm_ref) { *comm_ref = SIMIX_network_irecv(rdv,dst_buff,dst_buff_size); @@ -432,7 +432,7 @@ smx_comm_t SIMIX_network_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_s } /** @brief blocks until the communication terminates or the timeout occurs */ -void SIMIX_network_wait(smx_comm_t comm, double timeout) { +XBT_INLINE void SIMIX_network_wait(smx_comm_t comm, double timeout) { /* Wait for communication completion */ SIMIX_communication_wait_for_completion(comm, timeout); @@ -440,7 +440,7 @@ void SIMIX_network_wait(smx_comm_t comm, double timeout) { } /** @Returns whether the (asynchronous) communication is done yet or not */ -int SIMIX_network_test(smx_comm_t comm) { +XBT_INLINE int SIMIX_network_test(smx_comm_t comm) { return comm->sem?SIMIX_sem_would_block(comm->sem):0; } diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 46058f0181..009eb1d7c6 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -197,7 +197,7 @@ void SIMIX_process_kill(smx_process_t process) * \param process SIMIX process * \return A void pointer to the user data */ -void *SIMIX_process_get_data(smx_process_t process) +XBT_INLINE void *SIMIX_process_get_data(smx_process_t process) { xbt_assert0((process != NULL), "Invalid parameters"); return (process->data); @@ -210,7 +210,7 @@ void *SIMIX_process_get_data(smx_process_t process) * \param process SIMIX process * \param data User data */ -void SIMIX_process_set_data(smx_process_t process, void *data) +XBT_INLINE void SIMIX_process_set_data(smx_process_t process, void *data) { xbt_assert0((process != NULL), "Invalid parameters"); @@ -225,7 +225,7 @@ void SIMIX_process_set_data(smx_process_t process, void *data) * \param process SIMIX process * \return SIMIX host */ -smx_host_t SIMIX_process_get_host(smx_process_t process) +XBT_INLINE smx_host_t SIMIX_process_get_host(smx_process_t process) { xbt_assert0((process != NULL), "Invalid parameters"); return (process->smx_host); @@ -238,7 +238,7 @@ smx_host_t SIMIX_process_get_host(smx_process_t process) * \param process SIMIX process * \return The process name */ -const char *SIMIX_process_get_name(smx_process_t process) +XBT_INLINE const char *SIMIX_process_get_name(smx_process_t process) { xbt_assert0((process != NULL), "Invalid parameters"); return (process->name); @@ -251,7 +251,7 @@ const char *SIMIX_process_get_name(smx_process_t process) * \param process SIMIX process * \param name The new process name */ -void SIMIX_process_set_name(smx_process_t process, char *name) +XBT_INLINE void SIMIX_process_set_name(smx_process_t process, char *name) { xbt_assert0((process != NULL), "Invalid parameters"); process->name = name; @@ -262,7 +262,7 @@ void SIMIX_process_set_name(smx_process_t process, char *name) * * This functions returns the properties associated with this process */ -xbt_dict_t SIMIX_process_get_properties(smx_process_t process) +XBT_INLINE xbt_dict_t SIMIX_process_get_properties(smx_process_t process) { return process->properties; } @@ -273,7 +273,7 @@ xbt_dict_t SIMIX_process_get_properties(smx_process_t process) * This functions returns the currently running #smx_process_t. * \return The SIMIX process */ -smx_process_t SIMIX_process_self(void) +XBT_INLINE smx_process_t SIMIX_process_self(void) { return simix_global ? simix_global->current_process : NULL; } @@ -392,7 +392,7 @@ void SIMIX_process_change_host(smx_process_t process, char *source, * \param process SIMIX process * \return 1, if the process is suspended, else 0. */ -int SIMIX_process_is_suspended(smx_process_t process) +XBT_INLINE int SIMIX_process_is_suspended(smx_process_t process) { xbt_assert0((process != NULL), "Invalid parameters"); @@ -404,7 +404,7 @@ int SIMIX_process_is_suspended(smx_process_t process) * * Maestro internal process is not counted, only user code processes are */ -int SIMIX_process_count() +XBT_INLINE int SIMIX_process_count() { return xbt_swag_size(simix_global->process_list); } diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index 42d67bc080..8023ddebc4 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -74,7 +74,7 @@ void SIMIX_mutex_lock(smx_mutex_t mutex) * \param mutex The mutex * \return 1 - mutex free, 0 - mutex used */ -int SIMIX_mutex_trylock(smx_mutex_t mutex) +XBT_INLINE int SIMIX_mutex_trylock(smx_mutex_t mutex) { xbt_assert0((mutex != NULL), "Invalid parameters"); @@ -115,7 +115,7 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex) * Destroys and frees the mutex's memory. * \param mutex A mutex */ -void SIMIX_mutex_destroy(smx_mutex_t mutex) +XBT_INLINE void SIMIX_mutex_destroy(smx_mutex_t mutex) { if (mutex == NULL) return; @@ -203,7 +203,7 @@ void SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex) return; } -xbt_fifo_t SIMIX_cond_get_actions(smx_cond_t cond) +XBT_INLINE xbt_fifo_t SIMIX_cond_get_actions(smx_cond_t cond) { xbt_assert0((cond != NULL), "Invalid parameters"); return cond->actions; @@ -420,7 +420,7 @@ static inline void SIMIX_sem_block_onto(smx_sem_t sem) { } /** @brief Returns true if acquiring this semaphore would block */ -int SIMIX_sem_would_block(smx_sem_t sem) { +XBT_INLINE int SIMIX_sem_would_block(smx_sem_t sem) { return (sem->capacity>0); } diff --git a/src/surf/maxmin.c b/src/surf/maxmin.c index ce9d3adb10..5a0fe5aeea 100644 --- a/src/surf/maxmin.c +++ b/src/surf/maxmin.c @@ -105,7 +105,7 @@ static void lmm_var_free(lmm_system_t sys, lmm_variable_t var) xbt_mallocator_release(sys->variable_mallocator, var); } -static void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst) +static XBT_INLINE void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst) { /* xbt_assert0(xbt_swag_size(&(cnst->element_set)), */ /* "This list should be empty!"); */ @@ -135,17 +135,17 @@ lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id, return cnst; } -void lmm_constraint_shared(lmm_constraint_t cnst) +XBT_INLINE void lmm_constraint_shared(lmm_constraint_t cnst) { cnst->shared = 0; } -int lmm_constraint_is_shared(lmm_constraint_t cnst) +XBT_INLINE int lmm_constraint_is_shared(lmm_constraint_t cnst) { return (cnst->shared); } -void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst) +XBT_INLINE void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst) { remove_constraint(sys, cnst); lmm_cnst_free(sys, cnst); @@ -218,12 +218,12 @@ void lmm_variable_free(lmm_system_t sys, lmm_variable_t var) lmm_var_free(sys, var); } -double lmm_variable_getvalue(lmm_variable_t var) +XBT_INLINE double lmm_variable_getvalue(lmm_variable_t var) { return (var->value); } -double lmm_variable_getbound(lmm_variable_t var) +XBT_INLINE double lmm_variable_getbound(lmm_variable_t var) { return (var->bound); } @@ -289,7 +289,7 @@ void lmm_elem_set_value(lmm_system_t sys, lmm_constraint_t cnst, DIE_IMPOSSIBLE; } -lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys, +XBT_INLINE lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys, lmm_variable_t var, int num) { if (num < var->cnsts_number) @@ -298,7 +298,7 @@ lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys, return NULL; } -int lmm_get_number_of_cnst_from_var(lmm_system_t sys, lmm_variable_t var) +XBT_INLINE int lmm_get_number_of_cnst_from_var(lmm_system_t sys, lmm_variable_t var) { return (var->cnsts_number); } @@ -317,12 +317,12 @@ lmm_variable_t lmm_get_var_from_cnst(lmm_system_t sys, return NULL; } -void *lmm_constraint_id(lmm_constraint_t cnst) +XBT_INLINE void *lmm_constraint_id(lmm_constraint_t cnst) { return cnst->id; } -void *lmm_variable_id(lmm_variable_t var) +XBT_INLINE void *lmm_variable_id(lmm_variable_t var) { return var->id; } @@ -690,12 +690,12 @@ void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var, XBT_OUT; } -double lmm_get_variable_weight(lmm_variable_t var) +XBT_INLINE double lmm_get_variable_weight(lmm_variable_t var) { return var->weight; } -void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst, +XBT_INLINE void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst, double bound) { sys->modified = 1; @@ -703,17 +703,17 @@ void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst, cnst->bound = bound; } -int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst) +XBT_INLINE int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst) { return xbt_swag_belongs(cnst, &(sys->active_constraint_set)); } -lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys) +XBT_INLINE lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys) { return xbt_swag_getFirst(&(sys->active_constraint_set)); } -lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys, +XBT_INLINE lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys, lmm_constraint_t cnst) { return xbt_swag_getNext(cnst, (sys->active_constraint_set).offset); diff --git a/src/surf/maxmin_private.h b/src/surf/maxmin_private.h index 07428e1494..7d02bd7da3 100644 --- a/src/surf/maxmin_private.h +++ b/src/surf/maxmin_private.h @@ -93,7 +93,7 @@ typedef struct lmm_system { #define make_constraint_inactive(sys,cnst) remove_active_constraint(sys,cnst) static void lmm_var_free(lmm_system_t sys, lmm_variable_t var); -static void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst); +static XBT_INLINE void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst); void lmm_print(lmm_system_t sys); diff --git a/src/surf/surf_action.c b/src/surf/surf_action.c index 5ab946eedd..4e4707f6a1 100644 --- a/src/surf/surf_action.c +++ b/src/surf/surf_action.c @@ -58,18 +58,18 @@ e_surf_action_state_t surf_action_state_get(surf_action_t action) return SURF_ACTION_NOT_IN_THE_SYSTEM; } -double surf_action_get_start_time(surf_action_t action) +XBT_INLINE double surf_action_get_start_time(surf_action_t action) { return action->start; } -double surf_action_get_finish_time(surf_action_t action) +XBT_INLINE double surf_action_get_finish_time(surf_action_t action) { /* keep the function behavior, some models (cpu_ti) change the finish time before the action end */ return action->remains == 0 ? action->finish : -1; } -void surf_action_free(surf_action_t * action) +XBT_INLINE void surf_action_free(surf_action_t * action) { (*action)->model_type->action_cancel(*action); free(*action); @@ -98,12 +98,12 @@ void surf_action_state_set(surf_action_t action, e_surf_action_state_t state) XBT_OUT; } -void surf_action_data_set(surf_action_t action, void *data) +XBT_INLINE void surf_action_data_set(surf_action_t action, void *data) { action->data = data; } -void surf_action_ref(surf_action_t action) +XBT_INLINE void surf_action_ref(surf_action_t action) { action->refcount++; } diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 63c73ad28c..d65028f630 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -48,13 +48,13 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions, void (*solve) (lmm_system_t)); /* Generic functions common to all models */ -e_surf_action_state_t surf_action_state_get(surf_action_t action); -double surf_action_get_start_time(surf_action_t action); -double surf_action_get_finish_time(surf_action_t action); +XBT_INLINE e_surf_action_state_t surf_action_state_get(surf_action_t action); +XBT_INLINE double surf_action_get_start_time(surf_action_t action); +XBT_INLINE double surf_action_get_finish_time(surf_action_t action); void surf_action_free(surf_action_t * action); void surf_action_state_set(surf_action_t action, e_surf_action_state_t state); -void surf_action_data_set(surf_action_t action, void *data); +XBT_INLINE void surf_action_data_set(surf_action_t action, void *data); FILE *surf_fopen(const char *name, const char *mode); extern tmgr_history_t history; diff --git a/src/surf/trace_mgr.c b/src/surf/trace_mgr.c index fefbc2ab32..7cc122601d 100644 --- a/src/surf/trace_mgr.c +++ b/src/surf/trace_mgr.c @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_trace, surf, "Surf trace management"); static xbt_dict_t trace_list = NULL; -tmgr_history_t tmgr_history_new(void) +XBT_INLINE tmgr_history_t tmgr_history_new(void) { tmgr_history_t h; @@ -27,7 +27,7 @@ tmgr_history_t tmgr_history_new(void) return h; } -void tmgr_history_free(tmgr_history_t h) +XBT_INLINE void tmgr_history_free(tmgr_history_t h) { xbt_heap_free(h->heap); free(h); @@ -142,7 +142,7 @@ tmgr_trace_t tmgr_empty_trace_new(void) return trace; } -void tmgr_trace_free(tmgr_trace_t trace) +XBT_INLINE void tmgr_trace_free(tmgr_trace_t trace) { if (!trace) return; @@ -170,7 +170,7 @@ tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h, return trace_event; } -double tmgr_history_next_date(tmgr_history_t h) +XBT_INLINE double tmgr_history_next_date(tmgr_history_t h) { if (xbt_heap_size(h->heap)) return (xbt_heap_maxkey(h->heap)); @@ -213,7 +213,7 @@ tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h, return trace_event; } -void tmgr_finalize(void) +XBT_INLINE void tmgr_finalize(void) { xbt_dict_free(&trace_list); } diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 1ef05f0613..60937b3155 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -100,7 +100,7 @@ void xbt_dict_free(xbt_dict_t * dict) /** * Returns the amount of elements in the dict */ -unsigned int xbt_dict_size(xbt_dict_t dict) +XBT_INLINE unsigned int xbt_dict_size(xbt_dict_t dict) { return dict->count; } @@ -297,7 +297,7 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict, * set the \a data in the structure under the \a key, which is a * null terminated string. */ -void xbt_dict_set(xbt_dict_t dict, +XBT_INLINE void xbt_dict_set(xbt_dict_t dict, const char *key, void *data, void_f_pvoid_t free_ctn) { @@ -314,7 +314,7 @@ void xbt_dict_set(xbt_dict_t dict, * * Search the given \a key. Throws not_found_error when not found. */ -void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len) +XBT_INLINE void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len) { @@ -392,7 +392,7 @@ char *xbt_dict_get_key(xbt_dict_t dict, const void*data) { * Check xbt_dict_get_or_null() for a version returning NULL without exception when * not found. */ -void *xbt_dict_get(xbt_dict_t dict, const char *key) +XBT_INLINE void *xbt_dict_get(xbt_dict_t dict, const char *key) { unsigned int hash_code = xbt_dict_hash(key); @@ -414,7 +414,7 @@ void *xbt_dict_get(xbt_dict_t dict, const char *key) /** * \brief like xbt_dict_get(), but returning NULL when not found */ -void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key) +XBT_INLINE void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key) { unsigned int hash_code = xbt_dict_hash(key); xbt_dictelm_t current; @@ -442,7 +442,7 @@ void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key) * * Remove the entry associated with the given \a key (throws not_found) */ -void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len) +XBT_INLINE void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len) { @@ -484,7 +484,7 @@ void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len) * * Remove the entry associated with the given \a key */ -void xbt_dict_remove(xbt_dict_t dict, const char *key) +XBT_INLINE void xbt_dict_remove(xbt_dict_t dict, const char *key) { xbt_dict_remove_ext(dict, key, strlen(key)); } @@ -522,7 +522,7 @@ void xbt_dict_reset(xbt_dict_t dict) * \brief Return the number of elements in the dict. * \param dict a dictionary */ -int xbt_dict_length(xbt_dict_t dict) +XBT_INLINE int xbt_dict_length(xbt_dict_t dict) { xbt_assert(dict); diff --git a/src/xbt/dict_cursor.c b/src/xbt/dict_cursor.c index 1808ab8ba0..48503dc975 100644 --- a/src/xbt/dict_cursor.c +++ b/src/xbt/dict_cursor.c @@ -34,7 +34,7 @@ struct xbt_dict_cursor_ { /** @brief Creator * @param dict the dict */ -xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict) +XBT_INLINE xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict) { xbt_dict_cursor_t res = NULL; @@ -50,7 +50,7 @@ xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict) * @brief Destructor * @param cursor poor victim */ -void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor) +XBT_INLINE void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor) { if (*cursor) { xbt_free(*cursor); @@ -68,7 +68,7 @@ static XBT_INLINE void __cursor_not_null(xbt_dict_cursor_t cursor) /** @brief Reinitialize the cursor. Mandatory after removal or add in dict. */ -void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) +XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) { CDEBUG0(xbt_dict_cursor, "xbt_dict_cursor_rewind"); xbt_assert(cursor); @@ -87,7 +87,7 @@ void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) * @param dict on what to let the cursor iterate * @param[out] cursor dest address */ -void xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t * cursor) +XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t * cursor) { DEBUG0("xbt_dict_cursor_first"); if (!*cursor) { @@ -105,10 +105,8 @@ void xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t * cursor) /** * \brief Move to the next element. */ -void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) +XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) { - - xbt_dictelm_t current; int line; @@ -143,7 +141,7 @@ void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) * * @returns true if it's ok, false if there is no more data */ -int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, +XBT_INLINE int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, char **key, void **data) { @@ -171,7 +169,7 @@ int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, * @param cursor: the cursor * @returns the current key */ -char *xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor) +XBT_INLINE char *xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor) { __cursor_not_null(cursor); @@ -183,7 +181,7 @@ char *xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor) * @param cursor the cursor * @returns the current data */ -void *xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor) +XBT_INLINE void *xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor) { __cursor_not_null(cursor); diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 794af42d18..f48533938e 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -254,7 +254,7 @@ void xbt_dynar_free_container(xbt_dynar_t * dynar) * * \param dynar who to squeeze */ -void xbt_dynar_reset(xbt_dynar_t const dynar) +XBT_INLINE void xbt_dynar_reset(xbt_dynar_t const dynar) { _dynar_lock(dynar); @@ -313,7 +313,7 @@ void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) * kilkil a dynar and its content */ -void xbt_dynar_free(xbt_dynar_t * dynar) +XBT_INLINE void xbt_dynar_free(xbt_dynar_t * dynar) { if (dynar && *dynar) { xbt_dynar_reset(*dynar); @@ -331,7 +331,7 @@ void xbt_dynar_free_voidp(void *d) * * \param dynar the dynar we want to mesure */ -unsigned long xbt_dynar_length(const xbt_dynar_t dynar) +XBT_INLINE unsigned long xbt_dynar_length(const xbt_dynar_t dynar) { return (dynar ? (unsigned long) dynar->used : (unsigned long) 0); } @@ -342,7 +342,7 @@ unsigned long xbt_dynar_length(const xbt_dynar_t dynar) * \param idx index of the slot we want to retrieve * \param[out] dst where to put the result to. */ -void +XBT_INLINE void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void *const dst) { @@ -363,7 +363,7 @@ xbt_dynar_get_cpy(const xbt_dynar_t dynar, * \warning The returned value is the actual content of the dynar. * Make a copy before fooling with it. */ -void *xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx) +XBT_INLINE void *xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx) { void *res; @@ -402,7 +402,7 @@ _xbt_dynar_set(xbt_dynar_t dynar, * * If you want to free the previous content, use xbt_dynar_replace(). */ -void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void *const src) +XBT_INLINE void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void *const src) { _dynar_lock(dynar); @@ -487,7 +487,7 @@ void *xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx) * moving the previously existing value and all subsequent ones to one * position right in the dynar. */ -void +XBT_INLINE void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void *const src) { @@ -559,7 +559,7 @@ int xbt_dynar_member(xbt_dynar_t const dynar, void *const elem) * You can then use regular affectation to set its value instead of relying * on the slow memcpy. This is what xbt_dynar_push_as() does. */ -void *xbt_dynar_push_ptr(xbt_dynar_t const dynar) +XBT_INLINE void *xbt_dynar_push_ptr(xbt_dynar_t const dynar) { void *res; @@ -573,7 +573,7 @@ void *xbt_dynar_push_ptr(xbt_dynar_t const dynar) } /** @brief Add an element at the end of the dynar */ -void xbt_dynar_push(xbt_dynar_t const dynar, const void *const src) +XBT_INLINE void xbt_dynar_push(xbt_dynar_t const dynar, const void *const src) { _dynar_lock(dynar); /* checks done in xbt_dynar_insert_at_ptr */ @@ -586,7 +586,7 @@ void xbt_dynar_push(xbt_dynar_t const dynar, const void *const src) * You can then use regular affectation to set its value instead of relying * on the slow memcpy. This is what xbt_dynar_pop_as() does. */ -void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar) +XBT_INLINE void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar) { void *res; @@ -600,7 +600,7 @@ void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar) } /** @brief Get and remove the last element of the dynar */ -void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst) +XBT_INLINE void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst) { /* sanity checks done by remove_at */ @@ -614,7 +614,7 @@ void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst) * * This is less efficient than xbt_dynar_push() */ -void xbt_dynar_unshift(xbt_dynar_t const dynar, const void *const src) +XBT_INLINE void xbt_dynar_unshift(xbt_dynar_t const dynar, const void *const src) { /* sanity checks done by insert_at */ @@ -625,7 +625,7 @@ void xbt_dynar_unshift(xbt_dynar_t const dynar, const void *const src) * * This is less efficient than xbt_dynar_pop() */ -void xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst) +XBT_INLINE void xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst) { /* sanity checks done by remove_at */ @@ -653,7 +653,7 @@ static void _dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op) * operation, so make sure your function don't call any function * from xbt_dynar_* on it, or you'll get a deadlock. */ -void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op) +XBT_INLINE void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op) { _sanity_check_dynar(dynar); @@ -669,7 +669,7 @@ void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op) * * This function can be used while traversing without problem. */ -void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int *const cursor) +XBT_INLINE void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int *const cursor) { _xbt_dynar_remove_at(dynar, (*cursor)--, NULL); @@ -681,7 +681,7 @@ void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int *const cursor) * xbt_dynar_foreach loop, but shouldn't be called at the end of a * regular traversal reaching the end of the elements */ -void xbt_dynar_cursor_unlock(xbt_dynar_t dynar) +XBT_INLINE void xbt_dynar_cursor_unlock(xbt_dynar_t dynar) { _dynar_unlock(dynar); } diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index de76e6416d..ba7c0b2dfd 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -384,14 +384,14 @@ static void fifo_item_mallocator_reset_f(void *item) /** Constructor * \return a new bucket */ -xbt_fifo_item_t xbt_fifo_new_item(void) +XBT_INLINE xbt_fifo_item_t xbt_fifo_new_item(void) { return xbt_mallocator_get(item_mallocator); } /** \deprecated Use #xbt_fifo_new_item instead. */ -xbt_fifo_item_t xbt_fifo_newitem(void) +XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void) { WARN0("This function is deprecated. Use xbt_fifo_new_item."); return xbt_fifo_new_item(); @@ -403,7 +403,7 @@ xbt_fifo_item_t xbt_fifo_newitem(void) * * stores \a v in \a i. */ -void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v) +XBT_INLINE void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v) { xbt_fifo_setItemcontent(i, v); } @@ -412,7 +412,7 @@ void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v) * \param i a bucket * \return the object stored \a i. */ -void *xbt_fifo_get_item_content(xbt_fifo_item_t i) +XBT_INLINE void *xbt_fifo_get_item_content(xbt_fifo_item_t i) { return xbt_fifo_getItemcontent(i); } @@ -422,7 +422,7 @@ void *xbt_fifo_get_item_content(xbt_fifo_item_t i) * * Free the bucket but does not modifies the object (if any) that was stored in it. */ -void xbt_fifo_free_item(xbt_fifo_item_t b) +XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b) { xbt_mallocator_release(item_mallocator, b); return; @@ -431,7 +431,7 @@ void xbt_fifo_free_item(xbt_fifo_item_t b) /** Destructor * \deprecated Use #xbt_fifo_free_item instead. */ -void xbt_fifo_freeitem(xbt_fifo_item_t b) +XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t b) { WARN0("This function is deprecated. Use xbt_fifo_free_item."); xbt_fifo_free_item(b); @@ -442,7 +442,7 @@ void xbt_fifo_freeitem(xbt_fifo_item_t b) * \param f a list * \return the number of buckets in \a f. */ -int xbt_fifo_size(xbt_fifo_t f) +XBT_INLINE int xbt_fifo_size(xbt_fifo_t f) { return f->count; } @@ -451,14 +451,14 @@ int xbt_fifo_size(xbt_fifo_t f) * \param l a list * \return the head of \a l. */ -xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l) +XBT_INLINE xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l) { return l->head; } /** \deprecated Use #xbt_fifo_get_first_item instead. */ -xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l) +XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l) { WARN0("This function is deprecated. Use xbt_fifo_get_first_item."); return xbt_fifo_get_first_item(l); @@ -468,7 +468,7 @@ xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l) * \param i a bucket * \return the bucket that comes next */ -xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i) +XBT_INLINE xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i) { if (i) return i->next; @@ -487,7 +487,7 @@ xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i) * \param i a bucket * \return the bucket that is just before \a i. */ -xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i) +XBT_INLINE xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i) { if (i) return i->prev; diff --git a/src/xbt/heap.c b/src/xbt/heap.c index ed70485bc8..84eedac187 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -26,7 +26,7 @@ * * Creates a new heap. */ -xbt_heap_t xbt_heap_new(int init_size, void_f_pvoid_t const free_func) +XBT_INLINE xbt_heap_t xbt_heap_new(int init_size, void_f_pvoid_t const free_func) { xbt_heap_t H = xbt_new0(struct xbt_heap, 1); H->size = init_size; @@ -41,7 +41,7 @@ xbt_heap_t xbt_heap_new(int init_size, void_f_pvoid_t const free_func) * @param H the heap we're working on * \param update_callback function to call on each element to update its index when needed. */ -void xbt_heap_set_update_callback(xbt_heap_t H, +XBT_INLINE void xbt_heap_set_update_callback(xbt_heap_t H, void (*update_callback) (void *, int)) { H->update_callback = update_callback; @@ -68,7 +68,7 @@ void xbt_heap_free(xbt_heap_t H) * @param H the heap we're working on * @return the number of elements in the heap */ -int xbt_heap_size(xbt_heap_t H) +XBT_INLINE int xbt_heap_size(xbt_heap_t H) { return (H->count); } @@ -159,7 +159,7 @@ void *xbt_heap_remove(xbt_heap_t H, int i) * * \return the smallest key in the heap without modifying the heap. */ -double xbt_heap_maxkey(xbt_heap_t H) +XBT_INLINE double xbt_heap_maxkey(xbt_heap_t H) { xbt_assert0(H->count != 0, "Empty heap"); return KEY(H, 0); diff --git a/src/xbt/swag.c b/src/xbt/swag.c index 9d6c209b0b..435e5effb4 100644 --- a/src/xbt/swag.c +++ b/src/xbt/swag.c @@ -22,7 +22,7 @@ * * Usage : xbt_swag_new(&obj.setA-&obj); */ -xbt_swag_t xbt_swag_new(size_t offset) +XBT_INLINE xbt_swag_t xbt_swag_new(size_t offset) { xbt_swag_t swag = xbt_new0(s_xbt_swag_t, 1); @@ -37,7 +37,7 @@ xbt_swag_t xbt_swag_new(size_t offset) * kilkil a swag but not it's content. If you do not understand why * xbt_swag_free should not free its content, don't use swags. */ -void xbt_swag_free(xbt_swag_t swag) +XBT_INLINE void xbt_swag_free(xbt_swag_t swag) { free(swag); } @@ -49,7 +49,7 @@ void xbt_swag_free(xbt_swag_t swag) * * Usage : xbt_swag_init(swag,&obj.setA-&obj); */ -void xbt_swag_init(xbt_swag_t swag, size_t offset) +XBT_INLINE void xbt_swag_init(xbt_swag_t swag, size_t offset) { swag->tail = NULL; swag->head = NULL; @@ -209,7 +209,7 @@ void *xbt_swag_extract(xbt_swag_t swag) * \param swag a swag * \return the number of objects in \a swag */ -int xbt_swag_size(xbt_swag_t swag) +XBT_INLINE int xbt_swag_size(xbt_swag_t swag) { return (swag->count); } diff --git a/src/xbt/xbt_strbuff.c b/src/xbt/xbt_strbuff.c index b19cb4f9f4..c40e0fc19b 100644 --- a/src/xbt/xbt_strbuff.c +++ b/src/xbt/xbt_strbuff.c @@ -23,7 +23,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(strbuff, xbt, "String buffers"); ** Buffer code **/ -void xbt_strbuff_empty(xbt_strbuff_t b) +XBT_INLINE void xbt_strbuff_empty(xbt_strbuff_t b) { b->used = 0; b->data[0] = '\n'; @@ -43,7 +43,7 @@ xbt_strbuff_t xbt_strbuff_new(void) * * Beware, we store the ctn directly, not a copy of it */ -xbt_strbuff_t xbt_strbuff_new_from(char *ctn) +XBT_INLINE xbt_strbuff_t xbt_strbuff_new_from(char *ctn) { xbt_strbuff_t res = malloc(sizeof(s_xbt_strbuff_t)); res->data = ctn; @@ -52,13 +52,13 @@ xbt_strbuff_t xbt_strbuff_new_from(char *ctn) } /** @brief frees only the container without touching to the contained string */ -void xbt_strbuff_free_container(xbt_strbuff_t b) +XBT_INLINE void xbt_strbuff_free_container(xbt_strbuff_t b) { free(b); } /** @brief frees the buffer and its content */ -void xbt_strbuff_free(xbt_strbuff_t b) +XBT_INLINE void xbt_strbuff_free(xbt_strbuff_t b) { if (b) { if (b->data) @@ -87,7 +87,7 @@ void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd) b->used += addlen; } -void xbt_strbuff_chomp(xbt_strbuff_t b) +XBT_INLINE void xbt_strbuff_chomp(xbt_strbuff_t b) { while (b->data[b->used] == '\n') { b->data[b->used] = '\0'; @@ -96,7 +96,7 @@ void xbt_strbuff_chomp(xbt_strbuff_t b) } } -void xbt_strbuff_trim(xbt_strbuff_t b) +XBT_INLINE void xbt_strbuff_trim(xbt_strbuff_t b) { xbt_str_trim(b->data, " "); b->used = strlen(b->data); -- 2.20.1