# 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
* 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");
* \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");
*
* \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");
*
* \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");
*
* 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);
*
* 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);
* \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);
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);
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;
* \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.");
*
* \return Return the clock.
*/
-double SIMIX_get_clock(void)
+XBT_INLINE double SIMIX_get_clock(void)
{
return surf_get_clock();
}
*
* Must be called before the first call to SIMIX_solve()
*/
-void SIMIX_init(void)
+XBT_INLINE void SIMIX_init(void)
{
surf_presolve();
}
* \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);
}
* \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");
* \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");
* \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;
}
* \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");
* 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");
* 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");
* 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());
}
*
* \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));
}
*
* \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;
}
* \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");
* 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");
* \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");
* \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");
* \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");
* \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;
}
* \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);
}
* \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);
}
* \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;
}
* - 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)
{
* - 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);
}
/** @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);
}
/** @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;
}
* \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);
* \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");
* \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);
* \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);
* \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;
*
* 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;
}
* 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;
}
* \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");
*
* 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);
}
* \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");
* 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;
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;
}
/** @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);
}
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!"); */
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);
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);
}
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)
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);
}
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;
}
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;
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);
#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);
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);
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++;
}
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;
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;
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);
return trace;
}
-void tmgr_trace_free(tmgr_trace_t trace)
+XBT_INLINE void tmgr_trace_free(tmgr_trace_t trace)
{
if (!trace)
return;
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));
return trace_event;
}
-void tmgr_finalize(void)
+XBT_INLINE void tmgr_finalize(void)
{
xbt_dict_free(&trace_list);
}
/**
* 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;
}
* 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)
{
*
* 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)
{
* 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);
/**
* \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;
*
* 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)
{
*
* 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));
}
* \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);
/** @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;
* @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);
/** @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);
* @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) {
/**
* \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;
*
* @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)
{
* @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);
* @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);
*
* \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);
* 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);
*
* \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);
}
* \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)
{
* \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;
*
* 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);
* 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)
{
* 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;
}
/** @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 */
* 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;
}
/** @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 */
*
* 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 */
*
* 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 */
* 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);
*
* 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);
* 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);
}
/** 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();
*
* 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);
}
* \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);
}
*
* 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;
/** 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);
* \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;
}
* \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);
* \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;
* \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;
*
* 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;
* @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;
* @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);
}
*
* \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);
*
* 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);
* 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);
}
*
* 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;
* \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);
}
** 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';
*
* 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;
}
/** @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)
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';
}
}
-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);