Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove some useless nested code blocks.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 1 Mar 2021 22:36:32 +0000 (23:36 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 2 Mar 2021 09:50:36 +0000 (10:50 +0100)
src/mc/api.cpp
src/xbt/xbt_log_layout_format.cpp

index 94e0782..b04a44a 100644 (file)
@@ -553,11 +553,9 @@ RemotePtr<kernel::activity::MailboxImpl> Api::get_mbox_remote_addr(smx_simcall_t
   RemotePtr<kernel::activity::MailboxImpl> mbox_addr;
   switch (req->call_) {
     case Simcall::COMM_ISEND:
-    case Simcall::COMM_IRECV: {
-      auto mbox_addr_ptr = simix::unmarshal<smx_mailbox_t>(req->args_[1]);
-      mbox_addr          = remote(mbox_addr_ptr);
+    case Simcall::COMM_IRECV:
+      mbox_addr = remote(simix::unmarshal<smx_mailbox_t>(req->args_[1]));
       break;
-    }
     default:
       mbox_addr = RemotePtr<kernel::activity::MailboxImpl>();
       break;
@@ -570,11 +568,9 @@ RemotePtr<kernel::activity::ActivityImpl> Api::get_comm_remote_addr(smx_simcall_
   RemotePtr<kernel::activity::ActivityImpl> comm_addr;
   switch (req->call_) {
     case Simcall::COMM_ISEND:
-    case Simcall::COMM_IRECV: {
-      auto comm_addr_ptr = simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ActivityImpl*>(req->result_);
-      comm_addr          = remote(comm_addr_ptr);
+    case Simcall::COMM_IRECV:
+      comm_addr = remote(simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ActivityImpl*>(req->result_));
       break;
-    }
     default:
       comm_addr = RemotePtr<kernel::activity::ActivityImpl>();
       break;
@@ -655,11 +651,10 @@ std::list<transition_detail_t> Api::get_enabled_transitions(simgrid::mc::State*
     transition->call_             = simcall_call;
     switch (simcall_call) {
       case Simcall::COMM_ISEND:
-      case Simcall::COMM_IRECV: {
+      case Simcall::COMM_IRECV:
         transition->mbox_remote_addr = get_mbox_remote_addr(simcall);
         transition->comm_remote_addr = get_comm_remote_addr(simcall);
         break;
-      }
 
       default:
         break;
index 49c9ba2..3dedbd7 100644 (file)
@@ -87,6 +87,8 @@ static bool xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_even
     // *q == '%'
     q++;
     do {
+      int sz;
+      int len;
       switch (*q) {
         case '\0':
           fprintf(stderr, "Layout format (%s) ending with %%\n", (char*)l->data);
@@ -139,13 +141,11 @@ static bool xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_even
         case 'F': /* file name; LOG4J compliant */
           show_string(ev->fileName);
           break;
-        case 'l': { /* location; LOG4J compliant */
-          int sz;
+        case 'l': /* location; LOG4J compliant */
           set_sz_from_precision();
-          int len = snprintf(p, sz, "%s:%d", ev->fileName, ev->lineNum);
+          len = snprintf(p, sz, "%s:%d", ev->fileName, ev->lineNum);
           check_overflow(std::min(sz, len));
           break;
-        }
         case 'L': /* line number; LOG4J compliant */
           show_int(ev->lineNum);
           break;
@@ -156,16 +156,14 @@ static bool xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_even
         case 'r': /* application age; LOG4J compliant */
           show_double(simgrid_get_clock());
           break;
-        case 'm': { /* user-provided message; LOG4J compliant */
-          int sz;
+        case 'm': /* user-provided message; LOG4J compliant */
           set_sz_from_precision();
           va_list ap;
           va_copy(ap, ev->ap);
-          int len = vsnprintf(p, sz, msg_fmt, ap);
+          len = vsnprintf(p, sz, msg_fmt, ap);
           va_end(ap);
           check_overflow(std::min(sz, len));
           break;
-        }
         default:
           fprintf(stderr, ERRMSG, *q, (char*)l->data);
           xbt_abort();