PRINTF pointer difference (FIXME: advertise %td instead?)
printf ("diff = %ld\n", (long) (pointer2 - pointer1));
-INLINE functions
- The definition of a inline function must be visible when it is used.
- As such, an inline function should be defined (an not only declared)
- in header file (.h) with attributes 'static XBT_INLINE'. It should
- not be defined in source file (.c).
-
**
** Commenting the source: doxygen
**
#include "simgrid/msg.h"
#include "xbt/sysdep.h"
-static XBT_INLINE void queue_pending_connection(msg_comm_t comm, xbt_dynar_t q)
+static inline void queue_pending_connection(msg_comm_t comm, xbt_dynar_t q)
{
xbt_dynar_push(q, &comm);
}
# define _XBT_FUNCTION "function"
#endif
-#ifdef DOXYGEN
-# define XBT_INLINE
-#else
-# ifndef __cplusplus
-# if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
-# define XBT_INLINE inline
-# elif (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
-# define XBT_INLINE inline
-# else
-# define XBT_INLINE
-# endif
-# else
-# if defined (_MSC_VER)
-# define XBT_INLINE __inline
-# else
-# define XBT_INLINE inline
-# endif
-# endif /* __cplusplus */
-#endif
-
#if defined(__GNUC__)
# define XBT_ALWAYS_INLINE inline __attribute__ ((always_inline))
#else
-# define XBT_ALWAYS_INLINE XBT_INLINE
+# define XBT_ALWAYS_INLINE inline
#endif
#if defined(__GNUC__)
void_f_pvoid_t free_f;
} s_xbt_dynar_t;
-static XBT_INLINE int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void *const dst)
+static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void *const dst)
{
if (!dynar) /* iterating over a NULL dynar is a no-op */
return FALSE;
/**
* @brief Returns the hash code of a string.
*/
-static XBT_INLINE unsigned int xbt_str_hash_ext(const char *str, int str_len)
+static inline unsigned int xbt_str_hash_ext(const char *str, int str_len)
{
#ifdef DJB2_HASH_FUNCTION
/**
* @brief Returns the hash code of a string.
*/
-static XBT_INLINE unsigned int xbt_str_hash(const char *str)
+static inline unsigned int xbt_str_hash(const char *str)
{
#ifdef DJB2_HASH_FUNCTION
/* fast implementation of djb2 algorithm */
#define xbt_swag_getNext(obj, offset) (((xbt_swag_hookup_t)(((char *) (obj)) + (offset)))->next)
#define xbt_swag_belongs(obj, swag) (xbt_swag_getNext((obj), (swag)->offset) || (swag)->tail == (obj))
-static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag)
+static inline void *xbt_swag_getFirst(xbt_swag_t swag)
{
return (swag->head);
}
XBT_PUBLIC_DATA(double) sg_maxmin_precision;
XBT_PUBLIC_DATA(double) sg_surf_precision;
-static XBT_INLINE void double_update(double *variable, double value, double precision)
+static inline void double_update(double *variable, double value, double precision)
{
//printf("Updating %g -= %g +- %g\n",*variable,value,precision);
//xbt_assert(value==0 || value>precision);
*variable = 0.0;
}
-static XBT_INLINE int double_positive(double value, double precision)
+static inline int double_positive(double value, double precision)
{
return (value > precision);
}
-static XBT_INLINE int double_equals(double value1, double value2, double precision)
+static inline int double_equals(double value1, double value2, double precision)
{
return (fabs(value1 - value2) < precision);
}
}
/* Internal function used to factorize code between MSG_task_isend_with_matching() and MSG_task_dsend(). */
-static XBT_INLINE msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias,
+static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias,
int (*match_fun)(void*,void*, smx_synchro_t),
void *match_data, void_f_pvoid_t cleanup, int detached)
{
return task;
}
-static XBT_INLINE SD_task_t SD_task_create_sized(const char *name, void *data, double amount, int ws_count)
+static inline SD_task_t SD_task_create_sized(const char *name, void *data, double amount, int ws_count)
{
SD_task_t task = SD_task_create(name, data, amount);
task->bytes_amount = xbt_new0(double, ws_count * ws_count);
return max_time;
}
-static XBT_INLINE void SD_task_do_schedule(SD_task_t task)
+static inline void SD_task_do_schedule(SD_task_t task)
{
if (SD_task_get_state(task) > SD_SCHEDULABLE)
THROWF(arg_error, 0, "Task '%s' has already been scheduled", SD_task_get_name(task));
* \param context the context to destroy
* Argument must be stopped first -- runs in maestro context
*/
-static XBT_INLINE void SIMIX_context_free(smx_context_t context)
+static inline void SIMIX_context_free(smx_context_t context)
{
delete context;
}
* \brief stops the execution of a context
* \param context to stop
*/
-static XBT_INLINE void SIMIX_context_stop(smx_context_t context)
+static inline void SIMIX_context_stop(smx_context_t context)
{
context->stop();
}
scheduled it
\param context the context to be suspended (it must be the running one)
*/
-static XBT_INLINE void SIMIX_context_suspend(smx_context_t context)
+static inline void SIMIX_context_suspend(smx_context_t context)
{
context->suspend();
}
/**
\brief Executes all the processes to run (in parallel if possible).
*/
-static XBT_INLINE void SIMIX_context_runall(void)
+static inline void SIMIX_context_runall(void)
{
if (!xbt_dynar_is_empty(simix_global->process_to_run))
simix_global->context_factory->run_all();
/**
\brief returns the current running context
*/
-static XBT_INLINE smx_context_t SIMIX_context_self(void)
+static inline smx_context_t SIMIX_context_self(void)
{
if (simix_global && simix_global->context_factory)
return simix_global->context_factory->self();
\param context The context
\return The SIMIX process
*/
-static XBT_INLINE smx_process_t SIMIX_context_get_process(smx_context_t context)
+static inline smx_process_t SIMIX_context_get_process(smx_context_t context)
{
return context->process();
}
static int Global_const_debug_id = 1;
static void lmm_var_free(lmm_system_t sys, lmm_variable_t var);
-static XBT_INLINE void lmm_cnst_free(lmm_system_t sys,
+static inline void lmm_cnst_free(lmm_system_t sys,
lmm_constraint_t cnst);
static void lmm_on_disabled_var(lmm_system_t sys, lmm_constraint_t cnstr);
free(sys);
}
-static XBT_INLINE void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
+static inline void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
{
int i;
int nelements;
xbt_mallocator_release(sys->variable_mallocator, var);
}
-static XBT_INLINE void lmm_cnst_free(lmm_system_t sys,
+static inline void lmm_cnst_free(lmm_system_t sys,
lmm_constraint_t cnst)
{
make_constraint_inactive(sys, cnst);
* Apparently, this call was designed assuming that constraint would no more have elements in it.
* If this is not the case, assertion will fail, and you need to add calls e.g. to lmm_shrink before effectively removing it.
*/
-XBT_INLINE void lmm_constraint_free(lmm_system_t sys,
+inline void lmm_constraint_free(lmm_system_t sys,
lmm_constraint_t cnst)
{
xbt_assert(!xbt_swag_size(&(cnst->active_element_set)),"Removing constraint but it still has active elements");
return var->id;
}
-static XBT_INLINE void saturated_constraint_set_update(double usage,
+static inline void saturated_constraint_set_update(double usage,
int cnst_light_num,
dyn_light_t saturated_constraint_set,
double *min_usage)
}
}
-static XBT_INLINE void saturated_variable_set_update(
+static inline void saturated_variable_set_update(
s_lmm_constraint_light_t *cnst_light_tab,
dyn_light_t saturated_constraint_set,
lmm_system_t sys)
return xbt_swag_belongs(cnst, &(sys->active_constraint_set));
}
-XBT_INLINE lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t
+inline lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t
sys)
{
return (lmm_constraint_t)xbt_swag_getFirst(&(sys->active_constraint_set));
}
-XBT_INLINE lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t
+inline lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t
sys,
lmm_constraint_t
cnst)
XBT_PUBLIC(void) ns3_end_platform(void);
XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
-XBT_INLINE
+inline
ns3_nodes_t ns3_find_host(const char* id)
{
sg_host_t host = sg_host_by_name(id);
NS3Sim::~NS3Sim(){
}
-static XBT_INLINE void transformSocketPtr (Ptr<Socket> localSocket){
+static inline void transformSocketPtr (Ptr<Socket> localSocket){
std::stringstream sstream;
sstream << localSocket ;
std::string s = sstream.str();
* CallBacks *
*************/
-static XBT_INLINE void routing_storage_type_free(void *r)
+static inline void routing_storage_type_free(void *r)
{
storage_type_t stype = (storage_type_t) r;
free(stype->model);
free(stype);
}
-static XBT_INLINE void surf_storage_resource_free(void *r)
+static inline void surf_storage_resource_free(void *r)
{
// specific to storage
simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(r);
delete storage;
}
-static XBT_INLINE void routing_storage_host_free(void *r)
+static inline void routing_storage_host_free(void *r)
{
xbt_dynar_t dyn = (xbt_dynar_t) r;
xbt_dynar_free(&dyn);
return -1;
}
-static XBT_INLINE void surf_storage_free(void *r)
+static inline void surf_storage_free(void *r)
{
delete static_cast<simgrid::surf::Storage*>(r);
}
#define ROUTER_PEER(peername) bprintf("router_%s", peername)
#define LINK_PEER(peername) bprintf("link_%s", peername)
-static XBT_INLINE double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) {
+static inline double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) {
double src_coord, dst_coord;
src_coord = xbt_dynar_get_as(src, index, double);
/**
* Returns the amount of elements in the dict
*/
-XBT_INLINE unsigned int xbt_dict_size(xbt_dict_t dict)
+inline unsigned int xbt_dict_size(xbt_dict_t dict)
{
return (dict ? (unsigned int) dict->count : (unsigned int) 0);
}
* Set the \a data in the structure under the \a key, which can be any kind
* of data, as long as its length is provided in \a key_len.
*/
-XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
+inline void xbt_dict_set_ext(xbt_dict_t dict,
const char *key, int key_len,
void *data, void_f_pvoid_t free_ctn)
{
* set the \a data in the structure under the \a key, which is a
* null terminated string.
*/
-XBT_INLINE void xbt_dict_set(xbt_dict_t dict,
+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.
*/
-XBT_INLINE void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len)
+inline void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len)
{
unsigned int hash_code = xbt_str_hash_ext(key, key_len);
xbt_dictelm_t current = dict->table[hash_code & dict->table_size];
* Check xbt_dict_get_or_null() for a version returning NULL without exception when
* not found.
*/
-XBT_INLINE void *xbt_dict_get(xbt_dict_t dict, const char *key)
+inline void *xbt_dict_get(xbt_dict_t dict, const char *key)
{
return xbt_dict_get_elm(dict, key)->content;
}
* Check xbt_dict_get_or_null() for a version returning NULL without exception when
* not found.
*/
-XBT_INLINE xbt_dictelm_t xbt_dict_get_elm(xbt_dict_t dict, const char *key)
+inline xbt_dictelm_t xbt_dict_get_elm(xbt_dict_t dict, const char *key)
{
xbt_dictelm_t current = xbt_dict_get_elm_or_null(dict, key);
/**
* \brief like xbt_dict_get(), but returning NULL when not found
*/
-XBT_INLINE void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key)
+inline void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key)
{
xbt_dictelm_t current = xbt_dict_get_elm_or_null(dict, key);
/**
* \brief like xbt_dict_get_elm(), but returning NULL when not found
*/
-XBT_INLINE xbt_dictelm_t xbt_dict_get_elm_or_null(xbt_dict_t dict, const char *key)
+inline xbt_dictelm_t xbt_dict_get_elm_or_null(xbt_dict_t dict, const char *key)
{
unsigned int hash_code = xbt_str_hash(key);
xbt_dictelm_t current = dict->table[hash_code & dict->table_size];
*
* Remove the entry associated with the given \a key (throws not_found)
*/
-XBT_INLINE void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len)
+inline void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len)
{
unsigned int hash_code = xbt_str_hash_ext(key, key_len);
xbt_dictelm_t previous = NULL;
*
* Remove the entry associated with the given \a key
*/
-XBT_INLINE void xbt_dict_remove(xbt_dict_t dict, const char *key)
+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
*/
-XBT_INLINE int xbt_dict_length(xbt_dict_t dict)
+inline int xbt_dict_length(xbt_dict_t dict)
{
return dict->count;
}
/**
* \brief test if the dict is empty or not
*/
-XBT_INLINE int xbt_dict_is_empty(xbt_dict_t dict)
+inline int xbt_dict_is_empty(xbt_dict_t dict)
{
return !dict || (xbt_dict_length(dict) == 0);
}
/** @brief Creator
* @param dict the dict
*/
-XBT_INLINE xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict)
+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
*/
-XBT_INLINE void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor)
+inline void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor)
{
xbt_free(*cursor);
*cursor = NULL;
/*
* Sanity check to see if the head contains something
*/
-static XBT_INLINE void __cursor_not_null(xbt_dict_cursor_t cursor)
+static inline void __cursor_not_null(xbt_dict_cursor_t cursor)
{
xbt_assert(cursor, "Null cursor");
}
/** @brief Reinitialize the cursor. Mandatory after removal or add in dict. */
-XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor)
+inline void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor)
{
XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_rewind");
xbt_assert(cursor);
* @param dict on what to let the cursor iterate
* @param[out] cursor dest address
*/
-XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict,
+inline void xbt_dict_cursor_first(const xbt_dict_t dict,
xbt_dict_cursor_t * cursor)
{
XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_first");
/**
* \brief Move to the next element.
*/
-XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor)
+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
*/
-XBT_INLINE int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor,
+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
*/
-XBT_INLINE char *xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor)
+inline char *xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor)
{
__cursor_not_null(cursor);
* @param cursor the cursor
* @returns the current data
*/
-XBT_INLINE void *xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor)
+inline void *xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor)
{
__cursor_not_null(cursor);
* @param data the new data
* @param free_ctn the function to free the new data
*/
-XBT_INLINE void xbt_dict_cursor_set_data(xbt_dict_cursor_t cursor,
+inline void xbt_dict_cursor_set_data(xbt_dict_cursor_t cursor,
void *data,
void_f_pvoid_t free_ctn)
{
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dyn, xbt, "Dynamic arrays");
-static XBT_INLINE void _sanity_check_dynar(xbt_dynar_t dynar)
+static inline void _sanity_check_dynar(xbt_dynar_t dynar)
{
xbt_assert(dynar, "dynar is NULL");
}
-static XBT_INLINE void _sanity_check_idx(int idx)
+static inline void _sanity_check_idx(int idx)
{
xbt_assert(idx >= 0, "dynar idx(=%d) < 0", (int) (idx));
}
-static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx)
+static inline void _check_inbound_idx(xbt_dynar_t dynar, int idx)
{
if (idx < 0 || idx >= (int)dynar->used) {
THROWF(bound_error, idx,
}
}
-static XBT_INLINE void _check_populated_dynar(xbt_dynar_t dynar)
+static inline void _check_populated_dynar(xbt_dynar_t dynar)
{
if (dynar->used == 0) {
THROWF(bound_error, 0, "dynar %p is empty", dynar);
}
}
-static XBT_INLINE
+static inline
void _xbt_dynar_resize(xbt_dynar_t dynar, unsigned long new_size)
{
if (new_size != dynar->size) {
}
}
-static XBT_INLINE
+static inline
void _xbt_dynar_expand(xbt_dynar_t const dynar, const unsigned long nb)
{
const unsigned long old_size = dynar->size;
}
}
-static XBT_INLINE
+static inline
void *_xbt_dynar_elm(const xbt_dynar_t dynar, const unsigned long idx)
{
char *const data = (char *) dynar->data;
return data + idx * elmsize;
}
-static XBT_INLINE
+static inline
void
_xbt_dynar_get_elm(void *const dst,
const xbt_dynar_t dynar, const unsigned long idx)
*
* \param dynar who to squeeze
*/
-XBT_INLINE void xbt_dynar_reset(xbt_dynar_t const dynar)
+inline void xbt_dynar_reset(xbt_dynar_t const dynar)
{
_sanity_check_dynar(dynar);
* kilkil a dynar and its content
*/
-XBT_INLINE void xbt_dynar_free(xbt_dynar_t * dynar)
+inline void xbt_dynar_free(xbt_dynar_t * dynar)
{
if (dynar && *dynar) {
xbt_dynar_reset(*dynar);
*
* \param dynar the dynar we want to mesure
*/
-XBT_INLINE unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
+inline unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
{
return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
}
*\param dynar the dynat we want to check
*/
-XBT_INLINE int xbt_dynar_is_empty(const xbt_dynar_t dynar)
+inline int xbt_dynar_is_empty(const xbt_dynar_t dynar)
{
return (xbt_dynar_length(dynar) == 0);
}
* \param idx index of the slot we want to retrieve
* \param[out] dst where to put the result to.
*/
-XBT_INLINE void
+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.
*/
-XBT_INLINE void *xbt_dynar_get_ptr(const xbt_dynar_t dynar,
+inline void *xbt_dynar_get_ptr(const xbt_dynar_t dynar,
const unsigned long idx)
{
return res;
}
-XBT_INLINE void *xbt_dynar_set_at_ptr(const xbt_dynar_t dynar,
+inline void *xbt_dynar_set_at_ptr(const xbt_dynar_t dynar,
const unsigned long idx)
{
_sanity_check_dynar(dynar);
*
* If you want to free the previous content, use xbt_dynar_replace().
*/
-XBT_INLINE void xbt_dynar_set(xbt_dynar_t dynar, const int idx,
+inline void xbt_dynar_set(xbt_dynar_t dynar, const int idx,
const void *const src)
{
* moving the previously existing value and all subsequent ones to one
* position right in the dynar.
*/
-XBT_INLINE void
+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.
*/
-XBT_INLINE void *xbt_dynar_push_ptr(xbt_dynar_t const dynar)
+inline void *xbt_dynar_push_ptr(xbt_dynar_t const dynar)
{
return xbt_dynar_insert_at_ptr(dynar, dynar->used);
}
/** @brief Add an element at the end of the dynar */
-XBT_INLINE void xbt_dynar_push(xbt_dynar_t const dynar,
+inline void xbt_dynar_push(xbt_dynar_t const dynar,
const void *const src)
{
/* 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.
*/
-XBT_INLINE void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
+inline void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
{
_check_populated_dynar(dynar);
XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
}
/** @brief Get and remove the last element of the dynar */
-XBT_INLINE void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst)
+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()
*/
-XBT_INLINE void xbt_dynar_unshift(xbt_dynar_t const dynar,
+inline void xbt_dynar_unshift(xbt_dynar_t const dynar,
const void *const src)
{
*
* This is less efficient than xbt_dynar_pop()
*/
-XBT_INLINE void xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst)
+inline void xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst)
{
/* sanity checks done by remove_at */
* The mapped function may change the value of the element itself,
* but should not mess with the structure of the dynar.
*/
-XBT_INLINE void xbt_dynar_map(const xbt_dynar_t dynar,
+inline void xbt_dynar_map(const xbt_dynar_t dynar,
void_f_pvoid_t const op)
{
char *const data = (char *) dynar->data;
*
* This function can be used while traversing without problem.
*/
-XBT_INLINE void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
+inline void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
unsigned int *const cursor)
{
* Remark: if the elements stored in the dynar are structures, the compar_fn
* function has to retrieve the field to sort first.
*/
-XBT_INLINE void xbt_dynar_sort(xbt_dynar_t dynar,
+inline void xbt_dynar_sort(xbt_dynar_t dynar,
int_f_cpvoid_cpvoid_t compar_fn)
{
qsort(dynar->data, dynar->used, dynar->elmsize, compar_fn);
*
* Note: The dynar won't be usable afterwards.
*/
-XBT_INLINE void *xbt_dynar_to_array(xbt_dynar_t dynar)
+inline void *xbt_dynar_to_array(xbt_dynar_t dynar)
{
void *res;
xbt_dynar_shrink(dynar, 1);
/** Constructor
* \return a new bucket
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_new_item(void)
+inline xbt_fifo_item_t xbt_fifo_new_item(void)
{
return xbt_mallocator_get(item_mallocator);
}
/** \deprecated Use #xbt_fifo_new_item instead.
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void)
+inline xbt_fifo_item_t xbt_fifo_newitem(void)
{
XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_new_item.");
return xbt_fifo_new_item();
*
* stores \a v in \a i.
*/
-XBT_INLINE void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v)
+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.
*/
-XBT_INLINE void *xbt_fifo_get_item_content(xbt_fifo_item_t i)
+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.
*/
-XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b)
+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.
*/
-XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t b)
+inline void xbt_fifo_freeitem(xbt_fifo_item_t b)
{
XBT_CWARN(xbt_fifo, "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.
*/
-XBT_INLINE int xbt_fifo_size(xbt_fifo_t f)
+inline int xbt_fifo_size(xbt_fifo_t f)
{
return f->count;
}
*
* Returns NULL if the list is empty.
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l)
+inline xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l)
{
return l->head;
}
*
* Returns NULL if the list is empty.
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l)
+inline xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l)
{
return l->tail;
}
/** \deprecated Use #xbt_fifo_get_first_item instead.
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
+inline xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
{
XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_first_item.");
return xbt_fifo_get_first_item(l);
*
* Returns NULL if \a i is the tail of the list.
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i)
+inline xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i)
{
if (i)
return i->next;
*
* Returns NULL if \a i is the head of the list.
*/
-XBT_INLINE xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i)
+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_INLINE xbt_heap_t xbt_heap_new(int init_size,
+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);
* @param H the heap we're working on
* \param update_callback function to call on each element to update its index when needed.
*/
-XBT_INLINE void xbt_heap_set_update_callback(xbt_heap_t H,
+inline void xbt_heap_set_update_callback(xbt_heap_t H,
void (*update_callback) (void
*,
int))
* @param H the heap we're working on
* @return the number of elements in the heap
*/
-XBT_INLINE int xbt_heap_size(xbt_heap_t H)
+inline int xbt_heap_size(xbt_heap_t H)
{
return (H->count);
}
*
* \return the smallest key in the heap without modifying the heap.
*/
-XBT_INLINE double xbt_heap_maxkey(xbt_heap_t H)
+inline double xbt_heap_maxkey(xbt_heap_t H)
{
xbt_assert(H->count != 0, "Empty heap");
return KEY(H, 0);
* mallocators should be protected from concurrent accesses. */
static int initialization_done = 0;
-static XBT_INLINE void lock_reset(xbt_mallocator_t m)
+static inline void lock_reset(xbt_mallocator_t m)
{
m->lock = 0;
}
-static XBT_INLINE void lock_acquire(xbt_mallocator_t m)
+static inline void lock_acquire(xbt_mallocator_t m)
{
if (initialization_done > 1) {
int *lock = &m->lock;
}
}
-static XBT_INLINE void lock_release(xbt_mallocator_t m)
+static inline void lock_release(xbt_mallocator_t m)
{
if (initialization_done > 1)
__sync_lock_release(&m->lock);
}
/** used by the module to know if it's time to activate the mallocators yet */
-static XBT_INLINE int xbt_mallocator_is_active(void) {
+static inline int xbt_mallocator_is_active(void) {
#if MALLOCATOR_COMPILED_IN
return initialization_done && !MC_is_active();
#else
#define LOCK(mdp) pthread_mutex_lock(&mdp->mutex)
#define UNLOCK(mdp) pthread_mutex_unlock(&mdp->mutex)
-static XBT_INLINE void mmalloc_paranoia(struct mdesc *mdp){
+static inline void mmalloc_paranoia(struct mdesc *mdp){
/* nothing to fear for no */
*
* Usage : xbt_swag_new(&obj.setA-&obj);
*/
-XBT_INLINE xbt_swag_t xbt_swag_new(size_t offset)
+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.
*/
-XBT_INLINE void xbt_swag_free(xbt_swag_t swag)
+inline void xbt_swag_free(xbt_swag_t swag)
{
free(swag);
}
*
* Usage : xbt_swag_init(swag,&obj.setA-&obj);
*/
-XBT_INLINE void xbt_swag_init(xbt_swag_t swag, size_t offset)
+inline void xbt_swag_init(xbt_swag_t swag, size_t offset)
{
swag->tail = NULL;
swag->head = NULL;
* insert (at the head... you probably had a very good reason to do
* that, I hope you know what you're doing) \a obj in \a swag
*/
-XBT_INLINE void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
+inline void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
{
xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
"This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
* insert (at the tail... you probably had a very good reason to do
* that, I hope you know what you're doing) \a obj in \a swag
*/
-XBT_INLINE void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
+inline void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
{
xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
"This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
*
* removes \a obj from \a swag
*/
-XBT_INLINE void *xbt_swag_remove(void *obj, xbt_swag_t swag)
+inline void *xbt_swag_remove(void *obj, xbt_swag_t swag)
{
if (!obj)
return NULL;
* \param swag a swag
* \return the number of objects in \a swag
*/
-XBT_INLINE int xbt_swag_size(xbt_swag_t swag)
+inline int xbt_swag_size(xbt_swag_t swag)
{
return (swag->count);
}
** Buffer code
**/
-XBT_INLINE void xbt_strbuff_empty(xbt_strbuff_t b)
+inline void xbt_strbuff_empty(xbt_strbuff_t b)
{
b->used = 0;
b->data[0] = '\0';
*
* Beware, the ctn is copied, you want to free it afterward, anyhow
*/
-XBT_INLINE xbt_strbuff_t xbt_strbuff_new_from(const char *ctn)
+inline xbt_strbuff_t xbt_strbuff_new_from(const char *ctn)
{
xbt_strbuff_t res = xbt_malloc(sizeof(s_xbt_strbuff_t));
res->data = xbt_strdup(ctn);
}
/** @brief frees only the container without touching to the contained string */
-XBT_INLINE void xbt_strbuff_free_container(xbt_strbuff_t b)
+inline void xbt_strbuff_free_container(xbt_strbuff_t b)
{
free(b);
}
/** @brief frees the buffer and its content */
-XBT_INLINE void xbt_strbuff_free(xbt_strbuff_t b)
+inline void xbt_strbuff_free(xbt_strbuff_t b)
{
if (b) {
free(b->data);