From: Gabriel Corona Date: Wed, 6 Apr 2016 12:02:12 +0000 (+0200) Subject: [mc] Use nullptr consistently in C++ code X-Git-Tag: v3_13~149 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/928c7d925f7dd44da445d7032934577ac4d88770 [mc] Use nullptr consistently in C++ code --- diff --git a/src/mc/Client.cpp b/src/mc/Client.cpp index 5503344ee4..9fc8688739 100644 --- a/src/mc/Client.cpp +++ b/src/mc/Client.cpp @@ -68,7 +68,7 @@ Client* Client::initialize() client_ = std::unique_ptr(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(); diff --git a/src/mc/mc_compare.cpp b/src/mc/mc_compare.cpp index 06192f23c3..a5bf48afb1 100644 --- a/src/mc/mc_compare.cpp +++ b/src/mc/mc_compare.cpp @@ -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) diff --git a/src/mc/mc_diff.cpp b/src/mc/mc_diff.cpp index fb56120121..d0974ea51d 100644 --- a/src/mc/mc_diff.cpp +++ b/src/mc/mc_diff.cpp @@ -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) diff --git a/src/mc/mc_dwarf.cpp b/src/mc/mc_dwarf.cpp index 41161a49c0..af3042298a 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/mc_dwarf.cpp @@ -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; } } diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index 4ce08127cd..f7ac9b29a8 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -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, diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h index 81dc444172..38173265fa 100644 --- a/src/mc/mc_snapshot.h +++ b/src/mc/mc_snapshot.h @@ -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; }