Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 31 Oct 2016 23:02:01 +0000 (00:02 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 31 Oct 2016 23:02:01 +0000 (00:02 +0100)
src/xbt/backtrace_linux.cpp

index 49ec6a1..e37bbcc 100644 (file)
@@ -342,26 +342,22 @@ std::vector<std::string> resolveBacktrace(
 
 #if HAVE_MC
 int xbt_libunwind_backtrace(void** bt, int size){
 
 #if HAVE_MC
 int xbt_libunwind_backtrace(void** bt, int size){
-  int i = 0;
-  for(i=0; i < size; i++)
+  for (int i = 0; i < size; i++)
     bt[i] = nullptr;
 
     bt[i] = nullptr;
 
-  i=0;
-
   unw_cursor_t c;
   unw_context_t uc;
 
   unw_getcontext (&uc);
   unw_init_local (&c, &uc);
 
   unw_cursor_t c;
   unw_context_t uc;
 
   unw_getcontext (&uc);
   unw_init_local (&c, &uc);
 
-  unw_word_t ip;
-
   unw_step(&c);
 
   unw_step(&c);
 
-  while(unw_step(&c) >= 0 && i < size){
+  int i;
+  for (i = 0; unw_step(&c) >= 0 && i < size; i++) {
+    unw_word_t ip;
     unw_get_reg(&c, UNW_REG_IP, &ip);
     bt[i] = (void*)(long)ip;
     unw_get_reg(&c, UNW_REG_IP, &ip);
     bt[i] = (void*)(long)ip;
-    i++;
   }
 
   return i;
   }
 
   return i;