X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ad32fd753f73b8a8a14242781eb011e78446995a..219810d5f28a3f177c7d9341b0fd227cbf651082:/src/surf/maxmin.cpp diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 9ec893fd5c..e40a1ab08a 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); @@ -115,15 +115,16 @@ lmm_system_t lmm_system_new(int selective_update) void lmm_system_free(lmm_system_t sys) { - lmm_variable_t var = NULL; - lmm_constraint_t cnst = NULL; + lmm_variable_t var = nullptr; + lmm_constraint_t cnst = nullptr; + + if (!sys) + return; - while ((var = (lmm_variable_t) extract_variable(sys))) { XBT_WARN("Variable %d still in system when freing it: this may be a bug", var->id_int); lmm_var_free(sys, var); } - while ((cnst = (lmm_constraint_t) extract_constraint(sys))) lmm_cnst_free(sys, cnst); @@ -131,7 +132,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 +184,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 +257,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 +611,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 +633,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 +1241,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)