Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a few sonar treats
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 13 Jul 2017 12:18:31 +0000 (14:18 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 13 Jul 2017 12:18:31 +0000 (14:18 +0200)
examples/s4u/app-pingpong/s4u_app-pingpong.cpp
src/include/surf/surf.h
src/surf/HostImpl.hpp
src/surf/surf_interface.cpp
src/xbt/xbt_str.cpp

index eebe6e7..d47ff48 100644 (file)
@@ -38,7 +38,7 @@ static void ponger(std::vector<std::string> args)
 
   /* - Receive the (small) ping first ....*/
   double* sender_time =
-      (static_cast<double*>(simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getHost()->getName())->get()));
+      static_cast<double*>(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);
index 0c183af..00cdb55 100644 (file)
 #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
  *
index 7d53cd0..488962d 100644 (file)
@@ -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);
index fedd818..cf5f486 100644 (file)
@@ -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());
index 6637f21..ac5bc37 100644 (file)
@@ -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;