From: Frederic Suter Date: Thu, 13 Jul 2017 12:18:31 +0000 (+0200) Subject: a few sonar treats X-Git-Tag: v3_17~399 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8d3fd4dafe26b531ab1392486871775d47126bff a few sonar treats --- diff --git a/examples/s4u/app-pingpong/s4u_app-pingpong.cpp b/examples/s4u/app-pingpong/s4u_app-pingpong.cpp index eebe6e78a2..d47ff48d45 100644 --- a/examples/s4u/app-pingpong/s4u_app-pingpong.cpp +++ b/examples/s4u/app-pingpong/s4u_app-pingpong.cpp @@ -38,7 +38,7 @@ static void ponger(std::vector args) /* - Receive the (small) ping first ....*/ double* sender_time = - (static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get())); + static_cast(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get()); double communication_time = simgrid::s4u::Engine::getClock() - *sender_time; XBT_INFO("Task received : small communication (latency bound)"); XBT_INFO(" Ping time (latency bound) %f", communication_time); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 0c183afcf1..00cdb5526e 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -17,22 +17,11 @@ #include "simgrid/datatypes.h" #include "simgrid/forward.h" -SG_BEGIN_DECL() -/* Actions and models are highly connected structures... */ - -/* user-visible parameters */ -extern XBT_PRIVATE double sg_tcp_gamma; -extern XBT_PRIVATE double sg_sender_gap; -extern XBT_PRIVATE double sg_latency_factor; -extern XBT_PRIVATE double sg_bandwidth_factor; -extern XBT_PRIVATE double sg_weight_S_parameter; -extern XBT_PRIVATE int sg_network_crosstraffic; #ifdef __cplusplus namespace simgrid { namespace surf { - class Model; class CpuModel; class HostModel; @@ -69,6 +58,17 @@ typedef struct surf_File surf_File; #endif +SG_BEGIN_DECL() +/* Actions and models are highly connected structures... */ + +/* user-visible parameters */ +extern XBT_PRIVATE double sg_tcp_gamma; +extern XBT_PRIVATE double sg_sender_gap; +extern XBT_PRIVATE double sg_latency_factor; +extern XBT_PRIVATE double sg_bandwidth_factor; +extern XBT_PRIVATE double sg_weight_S_parameter; +extern XBT_PRIVATE int sg_network_crosstraffic; + /** @ingroup SURF_c_bindings * \brief Model datatype * diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 7d53cd0ca7..488962d320 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -20,9 +20,6 @@ namespace simgrid { namespace surf { - -class XBT_PRIVATE HostModel; -class XBT_PRIVATE HostImpl; class XBT_PRIVATE HostAction; } } @@ -44,7 +41,7 @@ namespace surf { * @brief SURF Host model interface class * @details A model is an object which handle the interactions between its Resources and its Actions */ -class HostModel : public Model { +class XBT_PRIVATE HostModel : public Model { public: HostModel() : Model() {} @@ -60,7 +57,7 @@ public: * @brief SURF Host interface class * @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage */ -class HostImpl : public simgrid::surf::PropertyHolder { +class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder { public: explicit HostImpl(s4u::Host* host); diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index fedd818021..cf5f486fa7 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -900,13 +900,8 @@ void Action::updateRemainingLazy(double now) double_update(&maxDuration_, delta, sg_surf_precision); //FIXME: duplicated code - if ((remains_ <= 0) && - (lmm_get_variable_weight(getVariable()) > 0)) { - finish(); - setState(Action::State::done); - heapRemove(getModel()->getActionHeap()); - } else if (((maxDuration_ != NO_MAX_DURATION) - && (maxDuration_ <= 0))) { + if (((remains_ <= 0) && (lmm_get_variable_weight(getVariable()) > 0)) || + ((maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))) { finish(); setState(Action::State::done); heapRemove(getModel()->getActionHeap()); diff --git a/src/xbt/xbt_str.cpp b/src/xbt/xbt_str.cpp index 6637f211da..ac5bc37168 100644 --- a/src/xbt/xbt_str.cpp +++ b/src/xbt/xbt_str.cpp @@ -371,7 +371,8 @@ xbt_dynar_t xbt_str_split_quoted(const char *s) /** @brief Join a set of strings as a single string */ char *xbt_str_join(xbt_dynar_t dyn, const char *sep) { - int len = 1, dyn_len = xbt_dynar_length(dyn); + int len = 1; + int dyn_len = xbt_dynar_length(dyn); unsigned int cpt; char* cursor;