Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small improvments advised by sonar
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 20 Jun 2016 23:11:30 +0000 (01:11 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 20 Jun 2016 23:36:21 +0000 (01:36 +0200)
include/simgrid/kernel/future.hpp
src/xbt/xbt_replay.cpp
src/xbt/xbt_str.cpp

index ffd1a33..9b6a5fc 100644 (file)
@@ -70,6 +70,8 @@ public:
       // executing it later:
       continuation_ = std::move(continuation);
       break;
+    default:
+      DIE_IMPOSSIBLE;
     }
   }
 
@@ -84,8 +86,8 @@ public:
   }
 
 protected:
-  FutureStateBase() {}
-  ~FutureStateBase() {};
+  FutureStateBase() = default;
+  ~FutureStateBase() = default;
 
   /** Set the future as ready and trigger the continuation */
   void set_ready()
@@ -252,7 +254,7 @@ public:
 template<class T>
 class Future {
 public:
-  Future() {}
+  Future() = default;
   Future(std::shared_ptr<FutureState<T>> state): state_(std::move(state)) {}
 
   // Move type:
index d9e475b..705cd0f 100644 (file)
@@ -148,8 +148,11 @@ int xbt_replay_action_runner(int argc, char *argv[])
 {
   int i;
   if (xbt_action_fp) {              // A unique trace file
-    char **evt;
-    while ((evt = action_get_action(argv[0]))) {
+    while (true) {
+      char **evt = action_get_action(argv[0]);
+      if (evt == nullptr)
+        break;
+
       char* lowername = str_tolower (evt[1]);
       action_fun function = (action_fun)xbt_dict_get(xbt_action_funs, lowername);
       xbt_free(lowername);
index 9f817dc..fb38748 100644 (file)
@@ -199,7 +199,8 @@ xbt_dynar_t xbt_str_split(const char *s, const char *sep)
   is_sep[0] = 1;                /* End of string is also separator */
 
   /* Do the job */
-  p = q = s;
+  p = s;
+  q = s;
   done = 0;
 
   if (s[0] == '\0')
@@ -234,7 +235,8 @@ xbt_dynar_t xbt_str_split_str(const char *s, const char *sep)
   int done;
   const char *p, *q;
 
-  p = q = s;
+  p = s;
+  q = s;
   done = 0;
 
   if (s[0] == '\0')
@@ -446,7 +448,8 @@ char *xbt_str_join_array(const char *const *strs, const char *sep)
   len += strlen(sep) * amount_strings;
 
   /* Do the job */
-  q = res = (char*) xbt_malloc(len);
+  res = (char*) xbt_malloc(len);
+  q = res;
   for (i=0;strs[i];i++) {
     if (i!=0) { // not first loop
       q += snprintf(q,len, "%s%s", sep, strs[i]);