Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Don't modify condition variable twice in for loops.
[simgrid.git] / src / xbt / xbt_log_layout_format.cpp
index 6f488e4..e07eca4 100644 (file)
@@ -75,7 +75,8 @@ static int xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_event
   int precision = -1;
   int length = -1;
 
-  for (char* q = static_cast<char*>(l->data) ; *q != '\0' ; q++) {
+  char* q = static_cast<char*>(l->data);
+  while (*q != '\0') {
     if (*q == '%') {
       q++;
       do {
@@ -169,6 +170,7 @@ static int xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_event
       *p = *q;
       check_overflow(1);
     }
+    q++;
   }
   *p = '\0';