From cfc676704bebcd57e5ea98bb43154245a150948f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 6 Mar 2016 10:46:56 +0100 Subject: [PATCH] 'inline' is C99, remove portability the layer --- README.coding | 6 ---- examples/msg/chainsend/common.h | 2 +- include/xbt/base.h | 22 +------------ include/xbt/dynar.h | 2 +- include/xbt/str.h | 4 +-- include/xbt/swag.h | 2 +- src/include/surf/maxmin.h | 6 ++-- src/msg/msg_gos.cpp | 2 +- src/simdag/sd_task.cpp | 4 +-- src/simix/smx_private.hpp | 12 +++---- src/surf/maxmin.cpp | 16 ++++----- src/surf/ns3/ns3_interface.h | 2 +- src/surf/ns3/ns3_simulator.cc | 2 +- src/surf/storage_n11.cpp | 6 ++-- src/surf/surf_interface.cpp | 2 +- src/surf/surf_routing_vivaldi.cpp | 2 +- src/xbt/dict.c | 24 +++++++------- src/xbt/dict_cursor.c | 20 ++++++------ src/xbt/dynar.c | 54 +++++++++++++++---------------- src/xbt/fifo.c | 24 +++++++------- src/xbt/heap.c | 8 ++--- src/xbt/mallocator.c | 8 ++--- src/xbt/mmalloc/mmprivate.h | 2 +- src/xbt/swag.c | 14 ++++---- src/xbt/xbt_strbuff.c | 8 ++--- 25 files changed, 114 insertions(+), 140 deletions(-) diff --git a/README.coding b/README.coding index a43aeed403..4dd9610f2d 100644 --- a/README.coding +++ b/README.coding @@ -107,12 +107,6 @@ INTEGERS 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 ** diff --git a/examples/msg/chainsend/common.h b/examples/msg/chainsend/common.h index 57ca331a25..1d1f8c48d8 100644 --- a/examples/msg/chainsend/common.h +++ b/examples/msg/chainsend/common.h @@ -10,7 +10,7 @@ #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); } diff --git a/include/xbt/base.h b/include/xbt/base.h index 8365b1dbb1..d266b5ad3a 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -85,30 +85,10 @@ # 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__) diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 9ac385ff20..6dcebc9fc0 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -203,7 +203,7 @@ typedef struct xbt_dynar_s { 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; diff --git a/include/xbt/str.h b/include/xbt/str.h index 2152866d34..05da4c6807 100644 --- a/include/xbt/str.h +++ b/include/xbt/str.h @@ -60,7 +60,7 @@ XBT_PUBLIC(double) xbt_str_parse_double(const char* str, const char* error_msg); /** * @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 @@ -102,7 +102,7 @@ static XBT_INLINE unsigned int xbt_str_hash_ext(const char *str, int str_len) /** * @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 */ diff --git a/include/xbt/swag.h b/include/xbt/swag.h index 87bfbb6b5f..fa96ed4d7d 100644 --- a/include/xbt/swag.h +++ b/include/xbt/swag.h @@ -110,7 +110,7 @@ XBT_PUBLIC(int) xbt_swag_size(xbt_swag_t swag); #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); } diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index 9aa09d257c..2e0f5ad551 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -125,7 +125,7 @@ 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); @@ -137,12 +137,12 @@ static XBT_INLINE void double_update(double *variable, double value, double prec *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); } diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 522485d2e2..5329078ccb 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -284,7 +284,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d } /* 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) { diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index bf221e9b91..c13942043e 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -116,7 +116,7 @@ SD_task_t SD_task_create(const char *name, void *data, double amount) 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); @@ -857,7 +857,7 @@ double SD_task_get_execution_time(SD_task_t task, int workstation_nb, const sg_h 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)); diff --git a/src/simix/smx_private.hpp b/src/simix/smx_private.hpp index 255105fca2..71504cd3a1 100644 --- a/src/simix/smx_private.hpp +++ b/src/simix/smx_private.hpp @@ -16,7 +16,7 @@ * \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; } @@ -25,7 +25,7 @@ static XBT_INLINE void SIMIX_context_free(smx_context_t 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(); } @@ -35,7 +35,7 @@ static XBT_INLINE void SIMIX_context_stop(smx_context_t context) 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(); } @@ -43,7 +43,7 @@ static XBT_INLINE void SIMIX_context_suspend(smx_context_t context) /** \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(); @@ -52,7 +52,7 @@ static XBT_INLINE void SIMIX_context_runall(void) /** \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(); @@ -65,7 +65,7 @@ static XBT_INLINE smx_context_t SIMIX_context_self(void) \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(); } diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 9ec893fd5c..978745febe 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -35,7 +35,7 @@ static int Global_debug_id = 1; 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); @@ -131,7 +131,7 @@ void lmm_system_free(lmm_system_t sys) 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; @@ -183,7 +183,7 @@ static void lmm_var_free(lmm_system_t sys, lmm_variable_t var) 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); @@ -256,7 +256,7 @@ int lmm_constraint_sharing_policy(lmm_constraint_t 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"); @@ -610,7 +610,7 @@ void *lmm_variable_id(lmm_variable_t var) 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) @@ -632,7 +632,7 @@ static XBT_INLINE void saturated_constraint_set_update(double 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) @@ -1240,13 +1240,13 @@ int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst) 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) diff --git a/src/surf/ns3/ns3_interface.h b/src/surf/ns3/ns3_interface.h index d5c3a87a8e..cc92d4871c 100644 --- a/src/surf/ns3/ns3_interface.h +++ b/src/surf/ns3/ns3_interface.h @@ -53,7 +53,7 @@ XBT_PUBLIC(void) ns3_add_link(int src, e_ns3_network_element_type_t type_src, 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); diff --git a/src/surf/ns3/ns3_simulator.cc b/src/surf/ns3/ns3_simulator.cc index 49d3595cb1..ccb10d6d71 100644 --- a/src/surf/ns3/ns3_simulator.cc +++ b/src/surf/ns3/ns3_simulator.cc @@ -33,7 +33,7 @@ NS3Sim::NS3Sim(){ NS3Sim::~NS3Sim(){ } -static XBT_INLINE void transformSocketPtr (Ptr localSocket){ +static inline void transformSocketPtr (Ptr localSocket){ std::stringstream sstream; sstream << localSocket ; std::string s = sstream.str(); diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 31002dcb6d..5eaa3ace9c 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -16,7 +16,7 @@ static xbt_swag_t storage_running_action_set_that_does_not_need_being_checked = * 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); @@ -28,7 +28,7 @@ static XBT_INLINE void routing_storage_type_free(void *r) 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(r); @@ -36,7 +36,7 @@ static XBT_INLINE void surf_storage_resource_free(void *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); diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 40f3e9d226..2f785d08d7 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -235,7 +235,7 @@ int find_model_description(s_surf_model_description_t * table, return -1; } -static XBT_INLINE void surf_storage_free(void *r) +static inline void surf_storage_free(void *r) { delete static_cast(r); } diff --git a/src/surf/surf_routing_vivaldi.cpp b/src/surf/surf_routing_vivaldi.cpp index 278d195ff8..9ac925abf4 100644 --- a/src/surf/surf_routing_vivaldi.cpp +++ b/src/surf/surf_routing_vivaldi.cpp @@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf" #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); diff --git a/src/xbt/dict.c b/src/xbt/dict.c index f04465a5c7..c2268fa373 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -98,7 +98,7 @@ void xbt_dict_free(xbt_dict_t * dict) /** * 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); } @@ -163,7 +163,7 @@ static void xbt_dict_rehash(xbt_dict_t dict) * 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) { @@ -218,7 +218,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. */ -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) { @@ -236,7 +236,7 @@ XBT_INLINE void xbt_dict_set(xbt_dict_t dict, * * 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]; @@ -307,7 +307,7 @@ char *xbt_dict_get_elm_key(xbt_dictelm_t elm) * 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; } @@ -322,7 +322,7 @@ XBT_INLINE void *xbt_dict_get(xbt_dict_t dict, const char *key) * 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); @@ -335,7 +335,7 @@ XBT_INLINE xbt_dictelm_t xbt_dict_get_elm(xbt_dict_t dict, const char *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); @@ -347,7 +347,7 @@ XBT_INLINE void *xbt_dict_get_or_null(xbt_dict_t dict, const char *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]; @@ -368,7 +368,7 @@ XBT_INLINE xbt_dictelm_t xbt_dict_get_elm_or_null(xbt_dict_t dict, const char *k * * 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; @@ -407,7 +407,7 @@ XBT_INLINE void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_le * * 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)); } @@ -437,7 +437,7 @@ void xbt_dict_reset(xbt_dict_t dict) * \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; } @@ -451,7 +451,7 @@ void xbt_dict_dump_output_string(void *s) /** * \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); } diff --git a/src/xbt/dict_cursor.c b/src/xbt/dict_cursor.c index 68c5440d06..c1c52fde10 100644 --- a/src/xbt/dict_cursor.c +++ b/src/xbt/dict_cursor.c @@ -27,7 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_cursor, xbt_dict, /** @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; @@ -43,7 +43,7 @@ XBT_INLINE xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict) * @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; @@ -52,14 +52,14 @@ XBT_INLINE void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor) /* * 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); @@ -78,7 +78,7 @@ XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t 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"); @@ -97,7 +97,7 @@ XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict, /** * \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; @@ -133,7 +133,7 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) * * @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) { @@ -161,7 +161,7 @@ XBT_INLINE int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, * @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); @@ -173,7 +173,7 @@ XBT_INLINE char *xbt_dict_cursor_get_key(xbt_dict_cursor_t 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); @@ -186,7 +186,7 @@ XBT_INLINE void *xbt_dict_cursor_get_data(xbt_dict_cursor_t 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) { diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 5885ce21af..10a1086d2a 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -15,17 +15,17 @@ 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, @@ -34,14 +34,14 @@ static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int 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) { @@ -50,7 +50,7 @@ void _xbt_dynar_resize(xbt_dynar_t dynar, unsigned long new_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; @@ -63,7 +63,7 @@ static XBT_INLINE } } -static XBT_INLINE +static inline void *_xbt_dynar_elm(const xbt_dynar_t dynar, const unsigned long idx) { char *const data = (char *) dynar->data; @@ -72,7 +72,7 @@ static XBT_INLINE 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) @@ -134,7 +134,7 @@ void xbt_dynar_free_container(xbt_dynar_t * dynar) * * \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); @@ -194,7 +194,7 @@ void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) * 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); @@ -213,7 +213,7 @@ void xbt_dynar_free_voidp(void *d) * * \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); } @@ -223,7 +223,7 @@ XBT_INLINE unsigned long xbt_dynar_length(const xbt_dynar_t dynar) *\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); } @@ -234,7 +234,7 @@ XBT_INLINE int xbt_dynar_is_empty(const xbt_dynar_t dynar) * \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) { @@ -253,7 +253,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. */ -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) { @@ -265,7 +265,7 @@ XBT_INLINE void *xbt_dynar_get_ptr(const xbt_dynar_t dynar, 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); @@ -289,7 +289,7 @@ XBT_INLINE void *xbt_dynar_set_at_ptr(const xbt_dynar_t 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) { @@ -359,7 +359,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. */ -XBT_INLINE void +inline void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void *const src) { @@ -525,13 +525,13 @@ 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. */ -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 */ @@ -543,7 +543,7 @@ XBT_INLINE void xbt_dynar_push(xbt_dynar_t const dynar, * 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); @@ -552,7 +552,7 @@ XBT_INLINE void *xbt_dynar_pop_ptr(xbt_dynar_t const 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 */ @@ -564,7 +564,7 @@ XBT_INLINE void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst) * * 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) { @@ -576,7 +576,7 @@ XBT_INLINE void xbt_dynar_unshift(xbt_dynar_t const dynar, * * 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 */ @@ -588,7 +588,7 @@ XBT_INLINE void xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst) * 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; @@ -609,7 +609,7 @@ XBT_INLINE void xbt_dynar_map(const xbt_dynar_t dynar, * * 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) { @@ -624,7 +624,7 @@ XBT_INLINE void xbt_dynar_cursor_rm(xbt_dynar_t dynar, * 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); @@ -692,7 +692,7 @@ XBT_PUBLIC(void) xbt_dynar_three_way_partition(xbt_dynar_t const dynar, * * 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); diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index 6647ae958d..df2439f6d5 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -420,14 +420,14 @@ static void fifo_item_mallocator_reset_f(void *item) /** 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(); @@ -439,7 +439,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void) * * 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); } @@ -448,7 +448,7 @@ XBT_INLINE void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *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); } @@ -458,7 +458,7 @@ XBT_INLINE 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. */ -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; @@ -467,7 +467,7 @@ XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b) /** 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); @@ -478,7 +478,7 @@ XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t 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; } @@ -489,7 +489,7 @@ XBT_INLINE int xbt_fifo_size(xbt_fifo_t f) * * 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; } @@ -500,14 +500,14 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l) * * 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); @@ -519,7 +519,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t 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; @@ -540,7 +540,7 @@ xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i) * * 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; diff --git a/src/xbt/heap.c b/src/xbt/heap.c index 2153d42c4b..469cc682dd 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -28,7 +28,7 @@ static void xbt_heap_increase_key(xbt_heap_t H, int i); * * 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); @@ -44,7 +44,7 @@ XBT_INLINE xbt_heap_t xbt_heap_new(int 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. */ -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)) @@ -73,7 +73,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 */ -XBT_INLINE int xbt_heap_size(xbt_heap_t H) +inline int xbt_heap_size(xbt_heap_t H) { return (H->count); } @@ -212,7 +212,7 @@ void xbt_heap_update(xbt_heap_t H, int i, double key) * * \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); diff --git a/src/xbt/mallocator.c b/src/xbt/mallocator.c index 9ac395b0c7..f355354b13 100644 --- a/src/xbt/mallocator.c +++ b/src/xbt/mallocator.c @@ -42,12 +42,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators"); * 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; @@ -56,7 +56,7 @@ static XBT_INLINE void lock_acquire(xbt_mallocator_t m) } } -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); @@ -76,7 +76,7 @@ void xbt_mallocator_initialization_is_done(int protect) } /** 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 diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 63e45bcab0..2528b8ff5c 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -308,7 +308,7 @@ XBT_PUBLIC( void *)mmorecore(struct mdesc *mdp, ssize_t size); #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 */ diff --git a/src/xbt/swag.c b/src/xbt/swag.c index 308074f4bf..71f6f001e3 100644 --- a/src/xbt/swag.c +++ b/src/xbt/swag.c @@ -20,7 +20,7 @@ * * 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); @@ -35,7 +35,7 @@ XBT_INLINE 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. */ -XBT_INLINE void xbt_swag_free(xbt_swag_t swag) +inline void xbt_swag_free(xbt_swag_t swag) { free(swag); } @@ -47,7 +47,7 @@ XBT_INLINE void xbt_swag_free(xbt_swag_t 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; @@ -62,7 +62,7 @@ XBT_INLINE void xbt_swag_init(xbt_swag_t swag, size_t offset) * 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?"); @@ -88,7 +88,7 @@ XBT_INLINE void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag) * 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?"); @@ -114,7 +114,7 @@ XBT_INLINE void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag) * * 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; @@ -177,7 +177,7 @@ void *xbt_swag_extract(xbt_swag_t swag) * \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); } diff --git a/src/xbt/xbt_strbuff.c b/src/xbt/xbt_strbuff.c index ae27f4e713..c3247d2118 100644 --- a/src/xbt/xbt_strbuff.c +++ b/src/xbt/xbt_strbuff.c @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(strbuff, xbt, "String buffers"); ** 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'; @@ -35,7 +35,7 @@ xbt_strbuff_t xbt_strbuff_new(void) * * 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); @@ -44,13 +44,13 @@ XBT_INLINE xbt_strbuff_t xbt_strbuff_new_from(const char *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); -- 2.20.1