Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use nullptr consistently in C++ code
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 6 Apr 2016 12:02:12 +0000 (14:02 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 6 Apr 2016 12:03:15 +0000 (14:03 +0200)
src/mc/Client.cpp
src/mc/mc_compare.cpp
src/mc/mc_diff.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_request.cpp
src/mc/mc_snapshot.h

index 5503344..9fc8688 100644 (file)
@@ -68,7 +68,7 @@ Client* Client::initialize()
   client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
 
   // Wait for the model-checker:
-  if (ptrace(PTRACE_TRACEME, 0, nullptr, NULL) == -1 || raise(SIGSTOP) != 0)
+  if (ptrace(PTRACE_TRACEME, 0, nullptr, nullptr) == -1 || raise(SIGSTOP) != 0)
     xbt_die("Could not wait for the model-checker");
 
   client_->handleMessages();
index 06192f2..a5bf48a 100644 (file)
@@ -146,9 +146,9 @@ static int compare_areas_with_type(ComparisonState& state,
 
     if (type->subtype && type->subtype->type == DW_TAG_subroutine_type)
       return (addr_pointed1 != addr_pointed2);
-    if (addr_pointed1 == nullptr && addr_pointed2 == NULL)
+    if (addr_pointed1 == nullptr && addr_pointed2 == nullptr)
       return 0;
-    if (addr_pointed1 == nullptr || addr_pointed2 == NULL)
+    if (addr_pointed1 == nullptr || addr_pointed2 == nullptr)
       return 1;
     if (!state.compared_pointers.insert(
         std::make_pair(addr_pointed1, addr_pointed2)).second)
index fb56120..d0974ea 100644 (file)
@@ -380,7 +380,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
           res_compare =
               compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
-                                nullptr, NULL, 0);
+                                nullptr, nullptr, 0);
 
           if (res_compare != 1) {
             for (k = 1; k < heapinfo2->busy_block.size; k++)
@@ -419,7 +419,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
         res_compare =
             compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
-                              nullptr, NULL, 0);
+                              nullptr, nullptr, 0);
 
         if (res_compare != 1) {
           for (k = 1; k < heapinfo2b->busy_block.size; k++)
@@ -471,7 +471,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
             res_compare =
                 compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot1, snapshot2,
-                                  nullptr, NULL, 0);
+                                  nullptr, nullptr, 0);
 
             if (res_compare != 1)
               equal = 1;
@@ -519,7 +519,7 @@ int mmalloc_compare_heap(simgrid::mc::Snapshot* snapshot1, simgrid::mc::Snapshot
 
             res_compare =
                 compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot2, snapshot2,
-                                  nullptr, NULL, 0);
+                                  nullptr, nullptr, 0);
 
             if (res_compare != 1) {
               equal = 1;
@@ -1023,7 +1023,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, s
   int type_size = -1;
   int offset1 = 0, offset2 = 0;
   int new_size1 = -1, new_size2 = -1;
-  simgrid::mc::Type *new_type1 = nullptr, *new_type2 = NULL;
+  simgrid::mc::Type *new_type1 = nullptr, *new_type2 = nullptr;
 
   int match_pairs = 0;
 
@@ -1307,7 +1307,7 @@ int compare_heap_area(int process_index, const void *area1, const void *area2, s
         return -1;
       }
 
-      if (new_type1 != nullptr && new_type2 != NULL && new_type1 != new_type2) {
+      if (new_type1 != nullptr && new_type2 != nullptr && new_type1 != new_type2) {
 
         type = new_type1;
         while (type->byte_size == 0 && type->subtype != nullptr)
index 41161a4..af30422 100644 (file)
@@ -998,11 +998,11 @@ void read_dwarf_info(simgrid::mc::ObjectInformation* info, Dwarf* dwarf)
   Dwarf_Off next_offset = 0;
   size_t length;
 
-  while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, NULL, NULL) ==
+  while (dwarf_nextcu(dwarf, offset, &next_offset, &length, nullptr, nullptr, nullptr) ==
          0) {
     Dwarf_Die unit_die;
     if (dwarf_offdie(dwarf, offset + length, &unit_die) != nullptr)
-      MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, NULL);
+      MC_dwarf_handle_children(info, &unit_die, &unit_die, nullptr, nullptr);
     offset = next_offset;
   }
 }
index 4ce0812..f7ac9b2 100644 (file)
@@ -107,7 +107,7 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
 
   if (r1->call == SIMCALL_COMM_WAIT
       && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
-      && (synchro1->comm.src_proc == nullptr || synchro1->comm.dst_proc == NULL))
+      && (synchro1->comm.src_proc == nullptr || synchro1->comm.dst_proc == nullptr))
     return false;
 
   if (r1->call == SIMCALL_COMM_TEST &&
@@ -314,7 +314,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
         act = remote_act;
 
     char* p;
-    if (act->comm.src_proc == nullptr || act->comm.dst_proc == NULL) {
+    if (act->comm.src_proc == nullptr || act->comm.dst_proc == nullptr) {
       type = "Test FALSE";
       p = pointer_to_string(remote_act);
       args = bprintf("comm=%s", p);
@@ -540,7 +540,7 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
     s_smx_synchro_t synchro;
     mc_model_checker->process().read_bytes(&synchro,
       sizeof(synchro), remote(remote_act));
-    if (synchro.comm.src_proc == nullptr || synchro.comm.dst_proc == NULL) {
+    if (synchro.comm.src_proc == nullptr || synchro.comm.dst_proc == nullptr) {
       if (issuer->host)
         label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE",
                     issuer->pid,
index 81dc444..3817326 100644 (file)
@@ -213,8 +213,8 @@ XBT_PRIVATE int MC_snapshot_memcmp(
 static inline __attribute__ ((always_inline))
 const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot)
 {
-  if(snapshot==NULL)
-      xbt_die("snapshot is NULL");
+  if(snapshot==nullptr)
+      xbt_die("snapshot is nullptr");
   return mc_model_checker->process().get_heap()->breakval;
 }