Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer nullptr and bool literals.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 5 Oct 2020 20:47:37 +0000 (22:47 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 6 Oct 2020 09:24:00 +0000 (11:24 +0200)
Clang-tidy enabled checks:
    modernize-use-bool-literals
    modernize-use-nullptr

58 files changed:
examples/deprecated/simdag/test/sd_test.cpp
examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp
examples/s4u/maestro-set/s4u-maestro-set.cpp
examples/s4u/replay-io/s4u-replay-io.cpp
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_file.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jtrace.cpp
src/bindings/java/jxbt_utilities.cpp
src/bindings/lua/lua_host.cpp
src/kernel/activity/CommImpl.cpp
src/mc/inspect/mc_dwarf.cpp
src/mc/remote/CheckerSide.cpp
src/s4u/s4u_Engine.cpp
src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/colls/allgather/allgather-mvapich-smp.cpp
src/smpi/colls/allgather/allgather-ompi-neighborexchange.cpp
src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp
src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp
src/smpi/colls/allgatherv/allgatherv-ompi-neighborexchange.cpp
src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp
src/smpi/colls/allreduce/allreduce-ompi-ring-segmented.cpp
src/smpi/colls/alltoall/alltoall-pair.cpp
src/smpi/colls/barrier/barrier-mpich-smp.cpp
src/smpi/colls/barrier/barrier-mvapich2-pair.cpp
src/smpi/colls/barrier/barrier-ompi.cpp
src/smpi/colls/bcast/bcast-mvapich-smp.cpp
src/smpi/colls/bcast/bcast-ompi-pipeline.cpp
src/smpi/colls/coll_tuned_topo.cpp
src/smpi/colls/gather/gather-mvapich.cpp
src/smpi/colls/gather/gather-ompi.cpp
src/smpi/colls/reduce/reduce-mvapich-knomial.cpp
src/smpi/colls/reduce/reduce-mvapich-two-level.cpp
src/smpi/colls/reduce/reduce-ompi.cpp
src/smpi/colls/reduce/reduce-scatter-gather.cpp
src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
src/smpi/colls/scatter/scatter-mvapich-two-level.cpp
src/smpi/colls/smpi_mvapich2_selector.cpp
src/smpi/colls/smpi_mvapich2_selector_stampede.hpp
src/smpi/include/smpi_keyvals.hpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_shared.cpp
src/smpi/mpi/smpi_request.cpp
src/smpi/mpi/smpi_win.cpp
src/surf/network_ns3.cpp
src/surf/ns3/ns3_simulator.cpp
src/surf/sg_platf.cpp
src/xbt/memory_map.cpp
teshsuite/s4u/cloud-two-execs/cloud-two-execs.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/xbt/mmalloc/mmalloc_test.cpp
teshsuite/xbt/parmap_bench/parmap_bench.cpp

index a2727ae..c6b4c51 100644 (file)
@@ -50,10 +50,10 @@ int main(int argc, char **argv)
            sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1));
 
   /* creation of the tasks and their dependencies */
-  SD_task_t taskA = SD_task_create("Task A", NULL, 10.0);
-  SD_task_t taskB = SD_task_create("Task B", NULL, 40.0);
-  SD_task_t taskC = SD_task_create("Task C", NULL, 30.0);
-  SD_task_t taskD = SD_task_create("Task D", NULL, 60.0);
+  SD_task_t taskA = SD_task_create("Task A", nullptr, 10.0);
+  SD_task_t taskB = SD_task_create("Task B", nullptr, 40.0);
+  SD_task_t taskC = SD_task_create("Task C", nullptr, 30.0);
+  SD_task_t taskD = SD_task_create("Task D", nullptr, 60.0);
 
   /* try to attach and retrieve user data to a task */
   SD_task_set_data(taskA, static_cast<void*>(&comp_amount1));
index 0c7f779..6d595d8 100644 (file)
@@ -28,7 +28,7 @@ static void node(int argc, char* argv[])
 
   if (argc == 4) {
     XBT_INFO("Hi, I'm going to join the network with id %u", node.getId());
-    unsigned int known_id = static_cast<unsigned int>(strtoul(argv[2], NULL, 0));
+    unsigned int known_id = static_cast<unsigned int>(strtoul(argv[2], nullptr, 0));
     join_success          = node.join(known_id);
     deadline              = std::stod(argv[3]);
   } else {
index 8188c9c..18fbaa0 100644 (file)
@@ -67,7 +67,7 @@ int main(int argc, char* argv[])
 
   /* Specify which code should be executed by maestro on another thread, once this current thread is affected to an
    * actor by the subsequent sg_actor_attach(). This must be done before the creation of the engine. */
-  SIMIX_set_maestro(maestro, NULL);
+  SIMIX_set_maestro(maestro, nullptr);
 
   simgrid::s4u::Engine e(&argc, argv);
 
index 6f6ae9d..2e02f08 100644 (file)
@@ -57,7 +57,7 @@ public:
     std::string full_name = simgrid::s4u::this_actor::get_name() + ":" + file_name;
 
     ACT_DEBUG("Entering Open: %s (filename: %s)", NAME.c_str(), file_name.c_str());
-    auto* file = new simgrid::s4u::File(file_name, NULL);
+    auto* file = new simgrid::s4u::File(file_name, nullptr);
 
     opened_files.insert({full_name, file});
 
index 6b71078..92f1b46 100644 (file)
@@ -107,7 +107,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv* env, jclass, jobjec
   args.emplace_back("java");
   for (int index = 1; index < argc; index++) {
     jstring jval    = (jstring)env->GetObjectArrayElement(jargs, index - 1);
-    const char* tmp = env->GetStringUTFChars(jval, 0);
+    const char* tmp = env->GetStringUTFChars(jval, nullptr);
     args.emplace_back(tmp);
     env->ReleaseStringUTFChars(jval, tmp);
   }
@@ -157,7 +157,7 @@ JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv* env, jclass)
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv* env, jclass, jstring jplatformFile)
 {
-  const char *platformFile = env->GetStringUTFChars(jplatformFile, 0);
+  const char* platformFile = env->GetStringUTFChars(jplatformFile, nullptr);
 
   simgrid_load_platform(platformFile);
 
@@ -184,42 +184,42 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Msg_environmentGetRoutingRoot(JNI
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_debug(JNIEnv* env, jclass, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   XBT_DEBUG("%s", s);
   env->ReleaseStringUTFChars(js, s);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_verb(JNIEnv* env, jclass, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   XBT_VERB("%s", s);
   env->ReleaseStringUTFChars(js, s);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_info(JNIEnv* env, jclass, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   XBT_INFO("%s", s);
   env->ReleaseStringUTFChars(js, s);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_warn(JNIEnv* env, jclass, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   XBT_WARN("%s", s);
   env->ReleaseStringUTFChars(js, s);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_error(JNIEnv* env, jclass, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   XBT_ERROR("%s", s);
   env->ReleaseStringUTFChars(js, s);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_critical(JNIEnv* env, jclass, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   XBT_CRITICAL("%s", s);
   env->ReleaseStringUTFChars(js, s);
 }
@@ -228,7 +228,7 @@ static void java_main(int argc, char* argv[]);
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_deployApplication(JNIEnv* env, jclass, jstring jdeploymentFile)
 {
-  const char *deploymentFile = env->GetStringUTFChars(jdeploymentFile, 0);
+  const char* deploymentFile = env->GetStringUTFChars(jdeploymentFile, nullptr);
 
   simgrid_register_default(java_main);
   simgrid_load_deployment(deploymentFile);
index 405df10..b87a5e9 100644 (file)
@@ -102,7 +102,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobje
     jxbt_throw_notbound(env, "as", jas);
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars(static_cast<jstring>(jname), 0);
+  const char* name = env->GetStringUTFChars(static_cast<jstring>(jname), nullptr);
 
   const char* property = sg_zone_get_property_value(as, name);
   if (not property) {
index 449f605..ce61fc7 100644 (file)
@@ -24,7 +24,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_File_nativeInit(JNIEnv *env, jclass
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_File_open(JNIEnv *env, jobject jfile, jobject jpath) {
-  const char *path = env->GetStringUTFChars((jstring) jpath, 0);
+  const char* path = env->GetStringUTFChars((jstring)jpath, nullptr);
   sg_file_t file   = sg_file_open(path, nullptr);
   jfile_bind(env, jfile, file);
 
index eab7f1b..75c2ad4 100644 (file)
@@ -60,7 +60,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName(JNIEnv* env, jclas
     jxbt_throw_null(env, "No host can have a null name");
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars(jname, 0);
+  const char* name = env->GetStringUTFChars(jname, nullptr);
   /* get the host by name       (the hosts are created during the grid resolution) */
   sg_host_t host = sg_host_by_name(name);
 
@@ -180,7 +180,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getProperty(JNIEnv *env, job
     jxbt_throw_notbound(env, "host", jhost);
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars((jstring) jname, 0);
+  const char* name = env->GetStringUTFChars((jstring)jname, nullptr);
 
   const char* property = sg_host_get_property_value(host, name);
   if (not property) {
@@ -202,8 +202,8 @@ Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname,
     jxbt_throw_notbound(env, "host", jhost);
     return;
   }
-  const char *name = env->GetStringUTFChars((jstring) jname, 0);
-  const char *value_java = env->GetStringUTFChars((jstring) jvalue, 0);
+  const char* name       = env->GetStringUTFChars((jstring)jname, nullptr);
+  const char* value_java = env->GetStringUTFChars((jstring)jvalue, nullptr);
   const char* value      = xbt_strdup(value_java);
 
   sg_host_set_property_value(host, name, value);
@@ -232,7 +232,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
-    return 0;
+    return nullptr;
   }
 
   int index = 0;
@@ -263,7 +263,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getAttachedStorage(JNIE
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
-    return 0;
+    return nullptr;
   }
   jobjectArray jtable;
 
@@ -287,7 +287,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getStorageContent(JNIEn
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
-    return 0;
+    return nullptr;
   }
   return (jobjectArray)sg_host_get_storage_content(host);
 }
@@ -324,7 +324,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv * env, jclas
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setAsyncMailbox(JNIEnv * env, jclass cls_arg, jobject jname)
 {
-  const char *name = env->GetStringUTFChars((jstring) jname, 0);
+  const char* name = env->GetStringUTFChars((jstring)jname, nullptr);
   sg_mailbox_set_receiver(name);
   env->ReleaseStringUTFChars((jstring) jname, name);
 }
index 11afaf7..bf00535 100644 (file)
@@ -71,7 +71,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
 
   /* Actually build the MSG process */
   jstring jname     = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name);
-  const char* name  = env->GetStringUTFChars(jname, 0);
+  const char* name  = env->GetStringUTFChars(jname, nullptr);
   auto actor_code   = [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); };
   smx_actor_t self  = SIMIX_process_self();
   sg_host_t host    = jhost_get_native(env, jhost);
@@ -141,7 +141,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv *env,
     jxbt_throw_notbound(env, "process", jprocess);
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars((jstring)jname, 0);
+  const char* name = env->GetStringUTFChars((jstring)jname, nullptr);
 
   const char* property = actor->get_property(name);
   if (not property)
index b88ed1c..6d3e349 100644 (file)
@@ -61,7 +61,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j
     jxbt_throw_null(env, "No host can have a null name");
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars(jname, 0);
+  const char* name = env->GetStringUTFChars(jname, nullptr);
   storage          = sg_storage_get_by_name(name);
 
   if (not storage) { /* invalid name */
@@ -143,7 +143,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env,
     jxbt_throw_notbound(env, "storage", jstorage);
     return nullptr;
   }
-  const char *name = env->GetStringUTFChars((jstring) jname, 0);
+  const char* name = env->GetStringUTFChars((jstring)jname, nullptr);
 
   const char* property = sg_storage_get_property_value(storage, name);
   if (not property) {
@@ -164,8 +164,8 @@ Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject
     jxbt_throw_notbound(env, "storage", jstorage);
     return;
   }
-  const char *name = env->GetStringUTFChars((jstring) jname, 0);
-  const char *value_java = env->GetStringUTFChars((jstring) jvalue, 0);
+  const char* name       = env->GetStringUTFChars((jstring)jname, nullptr);
+  const char* value_java = env->GetStringUTFChars((jstring)jvalue, nullptr);
 
   storage->set_property(name, std::string(value_java));
 
index 41f53c2..884a6cc 100644 (file)
@@ -60,7 +60,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_create(JNIEnv * env, jobject jt
   const char *name = nullptr;      /* the name of the task                                 */
 
   if (jname)
-    name = env->GetStringUTFChars(jname, 0);
+    name = env->GetStringUTFChars(jname, nullptr);
   msg_task_t task = MSG_task_create(name, jflopsAmount, jbytesAmount, jtask);
   if (jname)
     env->ReleaseStringUTFChars(jname, name);
@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo
 {
   int host_count = env->GetArrayLength(jhosts);
 
-  jdouble* jcomputeDurations = env->GetDoubleArrayElements(jcomputeDurations_arg, 0);
+  jdouble* jcomputeDurations = env->GetDoubleArrayElements(jcomputeDurations_arg, nullptr);
   msg_host_t* hosts          = new msg_host_t[host_count];
   double* computeDurations   = new double[host_count];
   for (int index = 0; index < host_count; index++) {
@@ -85,7 +85,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo
   }
   env->ReleaseDoubleArrayElements(jcomputeDurations_arg, jcomputeDurations, 0);
 
-  jdouble* jmessageSizes = env->GetDoubleArrayElements(jmessageSizes_arg, 0);
+  jdouble* jmessageSizes = env->GetDoubleArrayElements(jmessageSizes_arg, nullptr);
   double* messageSizes   = new double[host_count * host_count];
   for (int index = 0; index < host_count * host_count; index++) {
     messageSizes[index] = jmessageSizes[index];
@@ -93,7 +93,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jo
   env->ReleaseDoubleArrayElements(jmessageSizes_arg, jmessageSizes, 0);
 
   /* get the C string from the java string */
-  const char* name = env->GetStringUTFChars(jname, 0);
+  const char* name = env->GetStringUTFChars(jname, nullptr);
   msg_task_t task  = MSG_parallel_task_create(name, host_count, hosts, computeDurations, messageSizes, jtask);
   env->ReleaseStringUTFChars(jname, name);
 
@@ -215,7 +215,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setName(JNIEnv *env, jobject jt
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
-  const char *name = env->GetStringUTFChars((jstring) jname, 0);
+  const char* name = env->GetStringUTFChars((jstring)jname, nullptr);
 
   env->SetObjectField(jtask, jtask_field_Task_name, jname);
   MSG_task_set_name(task, name);
@@ -269,7 +269,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobjec
   /* Add a global ref into the Ctask so that the receiver can use it */
   MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
 
-  const char* alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
   msg_error_t res   = MSG_task_send_with_timeout_bounded(task, alias, jtimeout, maxrate);
   env->ReleaseStringUTFChars(jalias, alias);
 
@@ -281,7 +281,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass
 {
   msg_task_t task = nullptr;
 
-  const char *alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
   msg_error_t rv;
   if (not simgrid::ForcefulKillException::try_n_catch(
           [&rv, &task, &alias, &jtimeout]() { rv = MSG_task_receive_with_timeout(&task, alias, (double)jtimeout); })) {
@@ -319,7 +319,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass c
     return nullptr;
   }
 
-  const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
+  const char* mailbox = env->GetStringUTFChars(jmailbox, nullptr);
   msg_comm_t comm     = MSG_task_irecv(task, mailbox);
   env->ReleaseStringUTFChars(jmailbox, mailbox);
 
@@ -335,7 +335,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv* env,
 {
   msg_task_t task = nullptr;
 
-  const char *alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
   msg_error_t res   = MSG_task_receive_with_timeout_bounded(&task, alias, jtimeout, rate);
   if (env->ExceptionOccurred())
     return nullptr;
@@ -371,7 +371,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv * env, j
     return nullptr;
   }
 
-  const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
+  const char* mailbox = env->GetStringUTFChars(jmailbox, nullptr);
   msg_comm_t comm     = MSG_task_irecv_bounded(task, mailbox, rate);
   env->ReleaseStringUTFChars(jmailbox, mailbox);
 
@@ -392,7 +392,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject j
     return nullptr;
 
   jobject jcomm       = env->NewObject(comm_class, jtask_method_Comm_constructor);
-  const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
+  const char* mailbox = env->GetStringUTFChars(jmailbox, nullptr);
 
   msg_task_t task = jtask_to_native(jtask, env);
 
@@ -428,7 +428,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isendBounded(JNIEnv *env, jo
     return nullptr;
 
   jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
-  mailbox = env->GetStringUTFChars(jmailbox, 0);
+  mailbox = env->GetStringUTFChars(jmailbox, nullptr);
 
   task = jtask_to_native(jtask, env);
 
@@ -480,7 +480,7 @@ static void msg_task_cancel_on_failed_dsend(void*t) {
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jtask, jstring jalias)
 {
-  const char *alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
 
   msg_task_t task = jtask_to_native(jtask, env);
 
@@ -500,7 +500,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jta
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobject jtask, jstring jalias,
                                                               jdouble maxrate)
 {
-  const char *alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
 
   msg_task_t task = jtask_to_native(jtask, env);
 
@@ -519,7 +519,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobj
 
 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Task_listen(JNIEnv * env, jclass cls, jstring jalias)
 {
-  const char *alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
   int rv = MSG_task_listen(alias);
   env->ReleaseStringUTFChars(jalias, alias);
 
@@ -528,7 +528,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Task_listen(JNIEnv * env, jclass
 
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv * env, jclass cls, jstring jalias)
 {
-  const char *alias = env->GetStringUTFChars(jalias, 0);
+  const char* alias = env->GetStringUTFChars(jalias, nullptr);
   int rv = MSG_task_listen_from(alias);
   env->ReleaseStringUTFChars(jalias, alias);
 
index 8083992..6cebf90 100644 (file)
@@ -71,7 +71,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv* env, jobject jVm,
 {
   sg_host_t host = jhost_get_native(env, jHost);
 
-  const char* name = env->GetStringUTFChars(jname, 0);
+  const char* name = env->GetStringUTFChars(jname, nullptr);
   sg_vm_t vm       = sg_vm_create_migratable(host, name, static_cast<int>(coreAmount), static_cast<int>(jramsize),
                                        static_cast<int>(jmig_netspeed), static_cast<int>(jdp_intensity));
   env->ReleaseStringUTFChars(jname, name);
@@ -175,7 +175,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_VM_getVMByName(JNIEnv* env, jclas
     jxbt_throw_null(env, "No VM can have a null name");
     return nullptr;
   }
-  const char* name = env->GetStringUTFChars(jname, 0);
+  const char* name = env->GetStringUTFChars(jname, nullptr);
   /* get the VM by name   (VMs are just special hosts, unfortunately) */
   auto const* host = sg_host_by_name(name);
 
index 9d9b4e6..93133ad 100644 (file)
@@ -19,7 +19,7 @@
 
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclare(JNIEnv * env, jclass cls, jstring js)
 {
-  const char *s = env->GetStringUTFChars(js, 0);
+  const char* s = env->GetStringUTFChars(js, nullptr);
   TRACE_host_state_declare(s);
   env->ReleaseStringUTFChars(js, s);
 }
@@ -27,9 +27,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclare(JNIEnv * en
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclareValue (JNIEnv *env, jclass cls, jstring js_state,
                                                                            jstring js_value, jstring js_color)
 {
-  const char *state = env->GetStringUTFChars(js_state, 0);
-  const char *value = env->GetStringUTFChars(js_value, 0);
-  const char *color = env->GetStringUTFChars(js_color, 0);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
+  const char* value = env->GetStringUTFChars(js_value, nullptr);
+  const char* color = env->GetStringUTFChars(js_color, nullptr);
 
   TRACE_host_state_declare_value(state, value, color);
 
@@ -41,9 +41,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclareValue (JNIEn
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostSetState (JNIEnv *env, jclass cls, jstring js_host,
                                                                   jstring js_state, jstring js_value)
 {
-  const char *host = env->GetStringUTFChars(js_host, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
-  const char *value = env->GetStringUTFChars(js_value, 0);
+  const char* host  = env->GetStringUTFChars(js_host, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
+  const char* value = env->GetStringUTFChars(js_value, nullptr);
 
   TRACE_host_set_state(host, state, value);
 
@@ -55,9 +55,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostSetState (JNIEnv *env, j
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostPushState (JNIEnv *env, jclass cls, jstring js_host,
                                                                    jstring js_state, jstring js_value)
 {
-  const char *host = env->GetStringUTFChars(js_host, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
-  const char *value = env->GetStringUTFChars(js_value, 0);
+  const char* host  = env->GetStringUTFChars(js_host, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
+  const char* value = env->GetStringUTFChars(js_value, nullptr);
 
   TRACE_host_push_state(host, state, value);
 
@@ -69,8 +69,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostPushState (JNIEnv *env,
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostPopState (JNIEnv *env, jclass cls, jstring js_host,
                                                                   jstring js_state)
 {
-  const char *host = env->GetStringUTFChars(js_host, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* host  = env->GetStringUTFChars(js_host, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
 
   TRACE_host_pop_state(host, state);
 
@@ -80,7 +80,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostPopState (JNIEnv *env, j
 
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableDeclare (JNIEnv *env, jclass cls, jstring js_state)
 {
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
   TRACE_host_variable_declare(state);
   env->ReleaseStringUTFChars(js_state, state);
 }
@@ -88,8 +88,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableDeclare (JNIEnv
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableSet (JNIEnv *env, jclass cls, jstring js_host,
                                                                      jstring js_state, jdouble value)
 {
-  const char *host = env->GetStringUTFChars(js_host, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* host  = env->GetStringUTFChars(js_host, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
 
   TRACE_host_variable_set(host, state, value);
 
@@ -100,8 +100,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableSet (JNIEnv *env
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableSub (JNIEnv *env, jclass cls, jstring js_host,
                                                                      jstring js_state, jdouble value)
 {
-  const char *host = env->GetStringUTFChars(js_host, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* host  = env->GetStringUTFChars(js_host, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
 
   TRACE_host_variable_sub(host, state, value);
 
@@ -111,7 +111,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableSub (JNIEnv *env
 
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_vmVariableDeclare (JNIEnv *env, jclass cls, jstring js_state)
 {
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
 
   TRACE_vm_variable_declare(state);
 
@@ -121,8 +121,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_vmVariableDeclare (JNIEnv *e
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_vmVariableSet (JNIEnv *env, jclass cls, jstring js_vm,
                                                                    jstring js_state, jdouble value)
 {
-  const char *vm = env->GetStringUTFChars(js_vm, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* vm    = env->GetStringUTFChars(js_vm, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
 
   TRACE_vm_variable_set(vm, state, value);
 
@@ -133,8 +133,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_vmVariableSet (JNIEnv *env,
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableAdd (JNIEnv *env, jclass cls, jstring js_host,
                                                                      jstring js_state, jdouble value)
 {
-  const char *host = env->GetStringUTFChars(js_host, 0);
-  const char *state = env->GetStringUTFChars(js_state, 0);
+  const char* host  = env->GetStringUTFChars(js_host, nullptr);
+  const char* state = env->GetStringUTFChars(js_state, nullptr);
 
   TRACE_host_variable_set(host, state, value);
 
@@ -143,20 +143,20 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableAdd (JNIEnv *env
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableDeclare (JNIEnv *env, jclass cls, jstring jvar) {
-  const char *variable = env->GetStringUTFChars(jvar, 0);
+  const char* variable = env->GetStringUTFChars(jvar, nullptr);
   TRACE_link_variable_declare (variable);
   env->ReleaseStringUTFChars(jvar, variable);
 }
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableDeclareWithColor (JNIEnv *env, jclass cls, jstring jvar, jstring jcolor) {
-  const char *variable = env->GetStringUTFChars(jvar, 0);
-  const char *color = env->GetStringUTFChars(jcolor, 0);
+  const char* variable = env->GetStringUTFChars(jvar, nullptr);
+  const char* color    = env->GetStringUTFChars(jcolor, nullptr);
   TRACE_link_variable_declare_with_color(variable,color);
   env->ReleaseStringUTFChars(jvar, variable);
   env->ReleaseStringUTFChars(jcolor, color);
 }
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSet (JNIEnv *env, jclass cls, jstring jlink, jstring jvar, jdouble jvalue) {
-  const char *link = env->GetStringUTFChars(jlink, 0);
-  const char *variable = env->GetStringUTFChars(jvar, 0);
+  const char* link     = env->GetStringUTFChars(jlink, nullptr);
+  const char* variable = env->GetStringUTFChars(jvar, nullptr);
   TRACE_link_variable_set(link, variable, jvalue);
   env->ReleaseStringUTFChars(jlink, link);
   env->ReleaseStringUTFChars(jvar, variable);
@@ -164,9 +164,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSet (JNIEnv *env
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSet
   (JNIEnv *env, jclass cls, jstring jsrc, jstring jdst, jstring jvar, jdouble jval)
 {
-  const char *src = env->GetStringUTFChars(jsrc, 0);
-  const char *dst = env->GetStringUTFChars(jdst, 0);
-  const char *variable = env->GetStringUTFChars(jvar, 0);
+  const char* src      = env->GetStringUTFChars(jsrc, nullptr);
+  const char* dst      = env->GetStringUTFChars(jdst, nullptr);
+  const char* variable = env->GetStringUTFChars(jvar, nullptr);
   TRACE_link_srcdst_variable_set(src,dst,variable, jval);
   env->ReleaseStringUTFChars(jsrc, src);
   env->ReleaseStringUTFChars(jdst, dst);
index 8109312..9eb4936 100644 (file)
@@ -28,18 +28,18 @@ jmethodID jxbt_get_jmethod(JNIEnv * env, jclass cls, const char *name, const cha
   jmethodID id;
 
   if (not cls)
-    return 0;
+    return nullptr;
   id = env->GetMethodID(cls, name, signature);
 
   if (not id) {
     jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
     jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr);
-    const char *classname = env->GetStringUTFChars(jclassname, 0);
+    const char* classname = env->GetStringUTFChars(jclassname, nullptr);
 
     env->ReleaseStringUTFChars(jclassname, classname);
 
     jxbt_throw_jni(env, std::string("Cannot find method") + name + "(" + signature + ") in " + classname);
-    return 0;
+    return nullptr;
   }
 
   return id;
@@ -50,18 +50,18 @@ jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls, const char *name, co
   jmethodID id;
 
   if (not cls)
-    return 0;
+    return nullptr;
   id = env->GetStaticMethodID(cls, name, signature);
 
   if (not id) {
     jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
     jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr);
-    const char *classname = env->GetStringUTFChars(jclassname, 0);
+    const char* classname = env->GetStringUTFChars(jclassname, nullptr);
 
     env->ReleaseStringUTFChars(jclassname, classname);
 
     jxbt_throw_jni(env, std::string("Cannot find static method") + name + "(" + signature + ") in " + classname);
-    return 0;
+    return nullptr;
   }
 
   return id;
@@ -74,13 +74,13 @@ jmethodID jxbt_get_static_smethod(JNIEnv * env, const char *classname, const cha
   cls = jxbt_get_class(env, classname);
 
   if (not cls)
-    return 0;
+    return nullptr;
 
   id = env->GetStaticMethodID(cls, name, signature);
 
   if (not id) {
     jxbt_throw_jni(env, std::string("Cannot find static method") + name + "(" + signature + ") in " + classname);
-    return 0;
+    return nullptr;
   }
   return id;
 }
@@ -92,13 +92,13 @@ jmethodID jxbt_get_smethod(JNIEnv * env, const char *classname, const char *name
   cls = jxbt_get_class(env, classname);
 
   if (not cls)
-    return 0;
+    return nullptr;
 
   id = env->GetMethodID(cls, name, signature);
 
   if (not id) {
     jxbt_throw_jni(env, std::string("Cannot find method") + name + "(" + signature + ") in " + classname);
-    return 0;
+    return nullptr;
   }
   return id;
 }
@@ -108,20 +108,20 @@ jfieldID jxbt_get_jfield(JNIEnv * env, jclass cls, const char *name, const char
   jfieldID id;
 
   if (not cls)
-    return 0;
+    return nullptr;
 
   id = env->GetFieldID(cls, name, signature);
 
   if (not id) {
     jmethodID getname_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
     jstring jclassname = (jstring) env->CallObjectMethod(cls, getname_id, nullptr);
-    const char *classname = env->GetStringUTFChars(jclassname, 0);
+    const char* classname = env->GetStringUTFChars(jclassname, nullptr);
 
     env->ReleaseStringUTFChars(jclassname, classname);
 
     jxbt_throw_jni(env, std::string("Cannot find field") + signature + " " + name + " in " + classname);
 
-    return 0;
+    return nullptr;
   }
 
   return id;
@@ -133,13 +133,13 @@ jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname, const char *name,
   jfieldID id;
 
   if (not cls)
-    return 0;
+    return nullptr;
 
   id = env->GetFieldID(cls, name, signature);
 
   if (not id) {
     jxbt_throw_jni(env, std::string("Cannot find field") + signature + " " + name + " in " + classname);
-    return 0;
+    return nullptr;
   }
 
   return id;
index 298f30f..05baee2 100644 (file)
@@ -170,10 +170,7 @@ static int l_host_tostring(lua_State * L)
   return 1;
 }
 
-static const luaL_Reg host_meta[] = {
-  {"__tostring", l_host_tostring},
-  {0, 0}
-};
+static const luaL_Reg host_meta[] = {{"__tostring", l_host_tostring}, {nullptr, nullptr}};
 
 /**
  * @brief Registers the host functions into the table simgrid.host.
index 91e3f17..aea322a 100644 (file)
@@ -309,7 +309,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activi
   }
 
   if (timeout < 0.0) {
-    simcall->timeout_cb_ = NULL;
+    simcall->timeout_cb_ = nullptr;
   } else {
     simcall->timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall]() {
       simcall->timeout_cb_ = nullptr;
index a6d44f9..415ef79 100644 (file)
@@ -302,7 +302,7 @@ static uint64_t MC_dwarf_attr_integrate_uint(Dwarf_Die* die, int attribute, uint
 static bool MC_dwarf_attr_flag(Dwarf_Die* die, int attribute, bool integrate)
 {
   Dwarf_Attribute attr;
-  if ((integrate ? dwarf_attr_integrate(die, attribute, &attr) : dwarf_attr(die, attribute, &attr)) == 0)
+  if ((integrate ? dwarf_attr_integrate(die, attribute, &attr) : dwarf_attr(die, attribute, &attr)) == nullptr)
     return false;
 
   bool result;
index 36caac8..61991eb 100644 (file)
@@ -25,10 +25,10 @@ void CheckerSide::start(void (*handler)(int, short, void*))
   base_ = event_base_new();
 
   socket_event_ = event_new(base_, get_channel().get_socket(), EV_READ | EV_PERSIST, handler, this);
-  event_add(socket_event_, NULL);
+  event_add(socket_event_, nullptr);
 
   signal_event_ = event_new(base_, SIGCHLD, EV_SIGNAL | EV_PERSIST, handler, this);
-  event_add(signal_event_, NULL);
+  event_add(signal_event_, nullptr);
 }
 
 void CheckerSide::dispatch()
index 89b3ced..7dbfdaa 100644 (file)
@@ -58,7 +58,7 @@ Engine::~Engine()
 Engine* Engine::get_instance()
 {
   if (Engine::instance_ == nullptr) {
-    auto e = new Engine(0, nullptr);
+    auto e = new Engine(nullptr, nullptr);
     xbt_assert(Engine::instance_ == e);
   }
   return Engine::instance_;
index eca60b0..7d6a45d 100644 (file)
@@ -778,7 +778,7 @@ int PMPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status)
     *flag=1;
     simgrid::smpi::Status::empty(status);
     return MPI_SUCCESS;
-  } else if (flag==NULL || status ==NULL){
+  } else if (flag == nullptr || status == nullptr) {
     return MPI_ERR_ARG;
   }
   return simgrid::smpi::Request::get_status(request,flag,status);
index c7a2d48..8297387 100644 (file)
@@ -102,21 +102,20 @@ int allgather__mvapich2_smp(const void *sendbuf,int sendcnt, MPI_Datatype sendty
         /*When data in each socket is different*/
         if (not comm->is_uniform()) {
 
-            int *node_sizes = NULL;
-            int i = 0;
+          int* node_sizes = nullptr;
+          int i           = 0;
 
-            node_sizes = comm->get_non_uniform_map();
+          node_sizes = comm->get_non_uniform_map();
 
-            int* displs   = new int[leader_comm_size];
-            int* recvcnts = new int[leader_comm_size];
-            recvcnts[0] = node_sizes[0] * recvcnt;
-            displs[0] = 0;
-
-            for (i = 1; i < leader_comm_size; i++) {
-                displs[i] = displs[i - 1] + node_sizes[i - 1] * recvcnt;
-                recvcnts[i] = node_sizes[i] * recvcnt;
-            }
+          int* displs   = new int[leader_comm_size];
+          int* recvcnts = new int[leader_comm_size];
+          recvcnts[0]   = node_sizes[0] * recvcnt;
+          displs[0]     = 0;
 
+          for (i = 1; i < leader_comm_size; i++) {
+            displs[i]   = displs[i - 1] + node_sizes[i - 1] * recvcnt;
+            recvcnts[i] = node_sizes[i] * recvcnt;
+          }
 
             void* sendbuf=((char*)recvbuf)+recvtype->get_extent()*displs[leader_comm->rank()];
 
index 8a0a2b7..91ae678 100644 (file)
@@ -81,7 +81,7 @@ allgather__ompi_neighborexchange(const void *sbuf, int scount,
    int i, even_rank;
    int err = 0;
    ptrdiff_t slb, rlb, sext, rext;
-   char *tmpsend = NULL, *tmprecv = NULL;
+   char *tmpsend = nullptr, *tmprecv = nullptr;
 
    size = comm->size();
    rank = comm->rank();
index e923db5..026e817 100644 (file)
@@ -34,7 +34,7 @@ int allgatherv__mpich_ring(const void *sendbuf, int sendcount,
                            MPI_Comm comm)
 {
 
-  char * sbuf = NULL, * rbuf = NULL;
+  char *sbuf = nullptr, *rbuf = nullptr;
   int soffset, roffset;
   int torecv=0, tosend=0, min, rank, comm_size;
   int sendnow, recvnow;
index bb2ee44..9d5744f 100644 (file)
@@ -90,7 +90,7 @@ int allgatherv__ompi_bruck(const void *sbuf, int scount,
    int sendto, recvfrom, blockcount, i;
    unsigned int distance;
    ptrdiff_t slb, rlb, sext, rext;
-   char *tmpsend = NULL, *tmprecv = NULL;
+   char *tmpsend = nullptr, *tmprecv = nullptr;
    MPI_Datatype new_rdtype = MPI_DATATYPE_NULL, new_sdtype = MPI_DATATYPE_NULL;
 
    unsigned int size = comm->size();
index 2d07775..bf7b051 100644 (file)
@@ -82,8 +82,7 @@ allgatherv__ompi_neighborexchange(const void *sbuf, int scount,
     int i, even_rank;
     int err = 0;
     ptrdiff_t slb, rlb, sext, rext;
-    char *tmpsend = NULL, *tmprecv = NULL;
-
+    char *tmpsend = nullptr, *tmprecv = nullptr;
 
     size = comm->size();
     rank = comm->rank();
index 23d0267..cc77a93 100644 (file)
@@ -91,9 +91,9 @@ int allreduce__mvapich2_two_level(const void *sendbuf,
     int local_rank = -1, local_size = 0;
 
     //if not set (use of the algo directly, without mvapich2 selector)
-    if(MV2_Allreduce_intra_function==NULL)
+    if (MV2_Allreduce_intra_function == nullptr)
       MV2_Allreduce_intra_function = allreduce__mpich;
-    if(MV2_Allreducection==NULL)
+    if (MV2_Allreducection == nullptr)
       MV2_Allreducection = allreduce__rdb;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
index 47d62c6..bc010b4 100644 (file)
@@ -171,11 +171,11 @@ int allreduce__ompi_ring_segmented(const void *sbuf, void *rbuf, int count,
    int block_count;
    unsigned int inbi;
    size_t typelng;
-   char *tmpsend = NULL, *tmprecv = NULL;
+   char *tmpsend = nullptr, *tmprecv = nullptr;
    unsigned char* inbuf[2] = {nullptr, nullptr};
    ptrdiff_t true_extent, extent;
    ptrdiff_t block_offset, max_real_segsize;
-   MPI_Request reqs[2] = {NULL, NULL};
+   MPI_Request reqs[2]  = {nullptr, nullptr};
    const size_t segsize = 1 << 20; /* 1 MB */
    int size = comm->size();
    int rank = comm->rank();
@@ -231,7 +231,11 @@ int allreduce__ompi_ring_segmented(const void *sbuf, void *rbuf, int count,
 
    /* Allocate and initialize temporary buffers */
    inbuf[0] = smpi_get_tmp_sendbuffer(max_real_segsize);
-   if (NULL == inbuf[0]) { ret = -1; line = __LINE__; goto error_hndl; }
+   if (nullptr == inbuf[0]) {
+     ret  = -1;
+     line = __LINE__;
+     goto error_hndl;
+   }
    if (size > 2) {
      inbuf[1] = smpi_get_tmp_recvbuffer(max_real_segsize);
      if (nullptr == inbuf[1]) {
index 0f8a190..7e453a8 100644 (file)
@@ -47,8 +47,7 @@ int alltoall__pair_rma(const void *send_buff, int send_count, MPI_Datatype send_
   send_chunk = send_type->get_extent();
   recv_chunk = recv_type->get_extent();
 
-  win=new  Win(recv_buff, num_procs * recv_chunk * send_count, recv_chunk, 0,
-                 comm);
+  win = new Win(recv_buff, num_procs * recv_chunk * send_count, recv_chunk, nullptr, comm);
   send_chunk *= send_count;
   recv_chunk *= recv_count;
 
index 03efef5..ace6777 100644 (file)
@@ -31,31 +31,31 @@ int barrier__mpich_smp(MPI_Comm comm)
     shmem_comm = comm->get_intra_comm();
     local_rank = shmem_comm->rank();
     /* do the intranode barrier on all nodes */
-    if (shmem_comm != NULL) {
-        mpi_errno = barrier__mpich(shmem_comm);
-        if (mpi_errno) {
-          mpi_errno_ret+=mpi_errno;
-        }
+    if (shmem_comm != nullptr) {
+      mpi_errno = barrier__mpich(shmem_comm);
+      if (mpi_errno) {
+        mpi_errno_ret += mpi_errno;
+      }
     }
 
     leader_comm = comm->get_leaders_comm();
     /* do the barrier across roots of all nodes */
-    if (leader_comm != NULL && local_rank == 0) {
-        mpi_errno = barrier__mpich(leader_comm);
-        if (mpi_errno) {
-          mpi_errno_ret+=mpi_errno;
-        }
+    if (leader_comm != nullptr && local_rank == 0) {
+      mpi_errno = barrier__mpich(leader_comm);
+      if (mpi_errno) {
+        mpi_errno_ret += mpi_errno;
+      }
     }
 
     /* release the local processes on each node with a 1-byte
      * broadcast (0-byte broadcast just returns without doing
      * anything) */
-    if (shmem_comm != NULL) {
-        int i = 0;
-        mpi_errno = bcast__mpich(&i, 1, MPI_BYTE, 0, shmem_comm);
-        if (mpi_errno) {
-          mpi_errno_ret+=mpi_errno;
-        }
+    if (shmem_comm != nullptr) {
+      int i     = 0;
+      mpi_errno = bcast__mpich(&i, 1, MPI_BYTE, 0, shmem_comm);
+      if (mpi_errno) {
+        mpi_errno_ret += mpi_errno;
+      }
     }
 
     if (mpi_errno_ret)
index 073140e..88d8e5e 100644 (file)
@@ -68,30 +68,26 @@ int barrier__mvapich2_pair(MPI_Comm comm)
         if (rank < surfeit) {
             /* get the fanin letter from the upper "half" process: */
             dst = N2_prev + rank;
-            Request::recv(NULL, 0, MPI_BYTE, dst, COLL_TAG_BARRIER,
-                                     comm, MPI_STATUS_IGNORE);
+            Request::recv(nullptr, 0, MPI_BYTE, dst, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
         }
 
         /* combine on embedded N2_prev power-of-two processes */
         for (d = 1; d < N2_prev; d <<= 1) {
             dst = (rank ^ d);
-            Request::sendrecv(NULL, 0, MPI_BYTE, dst, COLL_TAG_BARRIER, NULL,
-                                 0, MPI_BYTE, dst, COLL_TAG_BARRIER, comm,
-                                 MPI_STATUS_IGNORE);
+            Request::sendrecv(nullptr, 0, MPI_BYTE, dst, COLL_TAG_BARRIER, nullptr, 0, MPI_BYTE, dst, COLL_TAG_BARRIER,
+                              comm, MPI_STATUS_IGNORE);
         }
 
         /* fanout data to nodes above N2_prev... */
         if (rank < surfeit) {
             dst = N2_prev + rank;
-            Request::send(NULL, 0, MPI_BYTE, dst, COLL_TAG_BARRIER,
-                                     comm);
+            Request::send(nullptr, 0, MPI_BYTE, dst, COLL_TAG_BARRIER, comm);
         }
     } else {
         /* fanin data to power of 2 subset */
         src = rank - N2_prev;
-        Request::sendrecv(NULL, 0, MPI_BYTE, src, COLL_TAG_BARRIER,
-                                     NULL, 0, MPI_BYTE, src, COLL_TAG_BARRIER,
-                                     comm, MPI_STATUS_IGNORE);
+        Request::sendrecv(nullptr, 0, MPI_BYTE, src, COLL_TAG_BARRIER, nullptr, 0, MPI_BYTE, src, COLL_TAG_BARRIER,
+                          comm, MPI_STATUS_IGNORE);
     }
 
     return mpi_errno;
index 396b274..29deacd 100644 (file)
@@ -59,40 +59,28 @@ int barrier__ompi_doublering(MPI_Comm comm)
     right = ((rank+1)%size);
 
     if (rank > 0) { /* receive message from the left */
-        Request::recv((void*)NULL, 0, MPI_BYTE, left,
-                                COLL_TAG_BARRIER, comm,
-                                MPI_STATUS_IGNORE);
+      Request::recv(nullptr, 0, MPI_BYTE, left, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
     }
 
     /* Send message to the right */
-    Request::send((void*)NULL, 0, MPI_BYTE, right,
-                            COLL_TAG_BARRIER,
-                             comm);
+    Request::send(nullptr, 0, MPI_BYTE, right, COLL_TAG_BARRIER, comm);
 
     /* root needs to receive from the last node */
     if (rank == 0) {
-        Request::recv((void*)NULL, 0, MPI_BYTE, left,
-                                COLL_TAG_BARRIER, comm,
-                                MPI_STATUS_IGNORE);
+      Request::recv(nullptr, 0, MPI_BYTE, left, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
     }
 
     /* Allow nodes to exit */
     if (rank > 0) { /* post Receive from left */
-        Request::recv((void*)NULL, 0, MPI_BYTE, left,
-                                COLL_TAG_BARRIER, comm,
-                                MPI_STATUS_IGNORE);
+      Request::recv(nullptr, 0, MPI_BYTE, left, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
     }
 
     /* send message to the right one */
-    Request::send((void*)NULL, 0, MPI_BYTE, right,
-                            COLL_TAG_BARRIER,
-                             comm);
+    Request::send(nullptr, 0, MPI_BYTE, right, COLL_TAG_BARRIER, comm);
 
     /* rank 0 post receive from the last node */
     if (rank == 0) {
-        Request::recv((void*)NULL, 0, MPI_BYTE, left,
-                                COLL_TAG_BARRIER, comm,
-                                MPI_STATUS_IGNORE);
+      Request::recv(nullptr, 0, MPI_BYTE, left, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
     }
 
     return MPI_SUCCESS;
@@ -124,19 +112,13 @@ int barrier__ompi_recursivedoubling(MPI_Comm comm)
         if (rank >= adjsize) {
             /* send message to lower ranked node */
             remote = rank - adjsize;
-            Request::sendrecv(NULL, 0, MPI_BYTE, remote,
-                                                  COLL_TAG_BARRIER,
-                                                  NULL, 0, MPI_BYTE, remote,
-                                                  COLL_TAG_BARRIER,
-                                                  comm, MPI_STATUS_IGNORE);
+            Request::sendrecv(nullptr, 0, MPI_BYTE, remote, COLL_TAG_BARRIER, nullptr, 0, MPI_BYTE, remote,
+                              COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
 
         } else if (rank < (size - adjsize)) {
 
             /* receive message from high level rank */
-            Request::recv((void*)NULL, 0, MPI_BYTE, rank+adjsize,
-                                    COLL_TAG_BARRIER, comm,
-                                    MPI_STATUS_IGNORE);
-
+            Request::recv(nullptr, 0, MPI_BYTE, rank + adjsize, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
         }
     }
 
@@ -149,11 +131,8 @@ int barrier__ompi_recursivedoubling(MPI_Comm comm)
             if (remote >= adjsize) continue;
 
             /* post receive from the remote node */
-            Request::sendrecv(NULL, 0, MPI_BYTE, remote,
-                                                  COLL_TAG_BARRIER,
-                                                  NULL, 0, MPI_BYTE, remote,
-                                                  COLL_TAG_BARRIER,
-                                                  comm, MPI_STATUS_IGNORE);
+            Request::sendrecv(nullptr, 0, MPI_BYTE, remote, COLL_TAG_BARRIER, nullptr, 0, MPI_BYTE, remote,
+                              COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
         }
     }
 
@@ -162,10 +141,7 @@ int barrier__ompi_recursivedoubling(MPI_Comm comm)
         if (rank < (size - adjsize)) {
             /* send enter message to higher ranked node */
             remote = rank + adjsize;
-            Request::send((void*)NULL, 0, MPI_BYTE, remote,
-                                    COLL_TAG_BARRIER,
-                                     comm);
-
+            Request::send(nullptr, 0, MPI_BYTE, remote, COLL_TAG_BARRIER, comm);
         }
     }
 
@@ -194,11 +170,8 @@ int barrier__ompi_bruck(MPI_Comm comm)
         to   = (rank + distance) % size;
 
         /* send message to lower ranked node */
-        Request::sendrecv(NULL, 0, MPI_BYTE, to,
-                                              COLL_TAG_BARRIER,
-                                              NULL, 0, MPI_BYTE, from,
-                                              COLL_TAG_BARRIER,
-                                              comm, MPI_STATUS_IGNORE);
+        Request::sendrecv(nullptr, 0, MPI_BYTE, to, COLL_TAG_BARRIER, nullptr, 0, MPI_BYTE, from, COLL_TAG_BARRIER,
+                          comm, MPI_STATUS_IGNORE);
     }
 
     return MPI_SUCCESS;
@@ -219,11 +192,8 @@ int barrier__ompi_two_procs(MPI_Comm comm)
                  "ompi_coll_tuned_barrier_ompi_two_procs rank %d", remote);
     remote = (remote + 1) & 0x1;
 
-    Request::sendrecv(NULL, 0, MPI_BYTE, remote,
-                                          COLL_TAG_BARRIER,
-                                          NULL, 0, MPI_BYTE, remote,
-                                          COLL_TAG_BARRIER,
-                                          comm, MPI_STATUS_IGNORE);
+    Request::sendrecv(nullptr, 0, MPI_BYTE, remote, COLL_TAG_BARRIER, nullptr, 0, MPI_BYTE, remote, COLL_TAG_BARRIER,
+                      comm, MPI_STATUS_IGNORE);
     return (MPI_SUCCESS);
 }
 
@@ -251,13 +221,9 @@ int barrier__ompi_basic_linear(MPI_Comm comm)
     /* All non-root send & receive zero-length message. */
 
     if (rank > 0) {
-        Request::send (NULL, 0, MPI_BYTE, 0,
-                                 COLL_TAG_BARRIER,
-                                  comm);
+      Request::send(nullptr, 0, MPI_BYTE, 0, COLL_TAG_BARRIER, comm);
 
-        Request::recv (NULL, 0, MPI_BYTE, 0,
-                                 COLL_TAG_BARRIER,
-                                 comm, MPI_STATUS_IGNORE);
+      Request::recv(nullptr, 0, MPI_BYTE, 0, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
     }
 
     /* The root collects and broadcasts the messages. */
@@ -267,15 +233,12 @@ int barrier__ompi_basic_linear(MPI_Comm comm)
 
         requests = new MPI_Request[size];
         for (i = 1; i < size; ++i) {
-          requests[i] = Request::irecv(NULL, 0, MPI_BYTE, i, COLL_TAG_BARRIER, comm);
+          requests[i] = Request::irecv(nullptr, 0, MPI_BYTE, i, COLL_TAG_BARRIER, comm);
         }
         Request::waitall( size-1, requests+1, MPI_STATUSES_IGNORE );
 
         for (i = 1; i < size; ++i) {
-            requests[i] = Request::isend(NULL, 0, MPI_BYTE, i,
-                                     COLL_TAG_BARRIER,
-                                      comm
-                                     );
+          requests[i] = Request::isend(nullptr, 0, MPI_BYTE, i, COLL_TAG_BARRIER, comm);
         }
         Request::waitall( size-1, requests+1, MPI_STATUSES_IGNORE );
         delete[] requests;
@@ -310,13 +273,9 @@ int barrier__ompi_tree(MPI_Comm comm)
         partner = rank ^ jump;
         if (!(partner & (jump-1)) && partner < size) {
             if (partner > rank) {
-                Request::recv (NULL, 0, MPI_BYTE, partner,
-                                         COLL_TAG_BARRIER, comm,
-                                         MPI_STATUS_IGNORE);
+              Request::recv(nullptr, 0, MPI_BYTE, partner, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
             } else if (partner < rank) {
-                Request::send (NULL, 0, MPI_BYTE, partner,
-                                         COLL_TAG_BARRIER,
-                                          comm);
+              Request::send(nullptr, 0, MPI_BYTE, partner, COLL_TAG_BARRIER, comm);
             }
         }
     }
@@ -326,13 +285,9 @@ int barrier__ompi_tree(MPI_Comm comm)
         partner = rank ^ jump;
         if (!(partner & (jump-1)) && partner < size) {
             if (partner > rank) {
-                Request::send (NULL, 0, MPI_BYTE, partner,
-                                         COLL_TAG_BARRIER,
-                                          comm);
+              Request::send(nullptr, 0, MPI_BYTE, partner, COLL_TAG_BARRIER, comm);
             } else if (partner < rank) {
-                Request::recv (NULL, 0, MPI_BYTE, partner,
-                                         COLL_TAG_BARRIER, comm,
-                                         MPI_STATUS_IGNORE);
+              Request::recv(nullptr, 0, MPI_BYTE, partner, COLL_TAG_BARRIER, comm, MPI_STATUS_IGNORE);
             }
         }
     }
index ca2b739..e61d7e2 100644 (file)
@@ -91,12 +91,11 @@ int bcast__mvapich2_inter_node(void *buffer,
     rank = comm->rank();
     //comm_size = comm->size();
 
-
-    if (MV2_Bcast_function==NULL){
+    if (MV2_Bcast_function == nullptr) {
       MV2_Bcast_function = bcast__mpich;
     }
 
-    if (MV2_Bcast_intra_node_function==NULL){
+    if (MV2_Bcast_intra_node_function == nullptr) {
       MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
@@ -179,11 +178,11 @@ int bcast__mvapich2_knomial_intra_node(void *buffer,
     int mpi_errno = MPI_SUCCESS;
     int src, dst, mask, relative_rank;
     int k;
-    if (MV2_Bcast_function==NULL){
+    if (MV2_Bcast_function == nullptr) {
       MV2_Bcast_function = bcast__mpich;
     }
 
-    if (MV2_Bcast_intra_node_function==NULL){
+    if (MV2_Bcast_intra_node_function == nullptr) {
       MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
@@ -259,11 +258,11 @@ int bcast__mvapich2_intra_node(void *buffer,
 
     if (count == 0)
         return MPI_SUCCESS;
-    if (MV2_Bcast_function==NULL){
+    if (MV2_Bcast_function == nullptr) {
       MV2_Bcast_function = bcast__mpich;
     }
 
-    if (MV2_Bcast_intra_node_function==NULL){
+    if (MV2_Bcast_intra_node_function == nullptr) {
       MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
index 805a8f6..ea77d92 100644 (file)
@@ -35,7 +35,7 @@ int bcast__ompi_pipeline( void* buffer,
     char *tmpbuf;
     ptrdiff_t extent;
     MPI_Request recv_reqs[2] = {MPI_REQUEST_NULL, MPI_REQUEST_NULL};
-    MPI_Request *send_reqs = NULL;
+    MPI_Request* send_reqs   = nullptr;
     int req_index;
 
     /**
index 28351a2..18c9e3b 100644 (file)
@@ -89,11 +89,11 @@ ompi_coll_tuned_topo_build_tree( int fanout,
 
     if (fanout<1) {
         XBT_DEBUG("coll:tuned:topo_build_tree invalid fanout %d", fanout);
-        return NULL;
+        return nullptr;
     }
     if (fanout>MAXTREEFANOUT) {
         XBT_DEBUG("coll:tuned:topo_build_tree invalid fanout %d bigger than max %d", fanout, MAXTREEFANOUT);
-        return NULL;
+        return nullptr;
     }
 
     /*
@@ -105,7 +105,7 @@ ompi_coll_tuned_topo_build_tree( int fanout,
     tree = new ompi_coll_tree_t;
     if (not tree) {
       XBT_DEBUG("coll:tuned:topo_build_tree PANIC::out of memory");
-      return NULL;
+      return nullptr;
     }
 
     /*
@@ -197,7 +197,7 @@ ompi_coll_tuned_topo_build_in_order_bintree( MPI_Comm comm )
     tree = new ompi_coll_tree_t;
     if (not tree) {
       XBT_DEBUG("coll:tuned:topo_build_tree PANIC::out of memory");
-      return NULL;
+      return nullptr;
     }
 
     /*
@@ -221,61 +221,63 @@ ompi_coll_tuned_topo_build_in_order_bintree( MPI_Comm comm )
     parent = size - 1;
     delta = 0;
 
-    while ( 1 ) {
-        /* Compute the size of the right subtree */
-        int rightsize = size >> 1;
-
-        /* Determine the left and right child of this parent  */
-        int lchild = -1;
-        int rchild = -1;
-        if (size - 1 > 0) {
-            lchild = parent - 1;
-            if (lchild > 0) {
-                rchild = rightsize - 1;
-            }
+    while (true) {
+      /* Compute the size of the right subtree */
+      int rightsize = size >> 1;
+
+      /* Determine the left and right child of this parent  */
+      int lchild = -1;
+      int rchild = -1;
+      if (size - 1 > 0) {
+        lchild = parent - 1;
+        if (lchild > 0) {
+          rchild = rightsize - 1;
         }
+      }
 
-        /* The following cases are possible: myrank can be
-           - a parent,
-           - belong to the left subtree, or
-           - belong to the right subtee
-           Each of the cases need to be handled differently.
+      /* The following cases are possible: myrank can be
+         - a parent,
+         - belong to the left subtree, or
+         - belong to the right subtee
+         Each of the cases need to be handled differently.
+      */
+
+      if (myrank == parent) {
+        /* I am the parent:
+           - compute real ranks of my children, and exit the loop. */
+        if (lchild >= 0)
+          tree->tree_next[0] = lchild + delta;
+        if (rchild >= 0)
+          tree->tree_next[1] = rchild + delta;
+        break;
+      }
+      if (myrank > rchild) {
+        /* I belong to the left subtree:
+           - If I am the left child, compute real rank of my parent
+           - Iterate down through tree:
+           compute new size, shift ranks down, and update delta.
         */
-
-        if (myrank == parent) {
-            /* I am the parent:
-               - compute real ranks of my children, and exit the loop. */
-            if (lchild >= 0) tree->tree_next[0] = lchild + delta;
-            if (rchild >= 0) tree->tree_next[1] = rchild + delta;
-            break;
+        if (myrank == lchild) {
+          tree->tree_prev = parent + delta;
         }
-        if (myrank > rchild) {
-            /* I belong to the left subtree:
-               - If I am the left child, compute real rank of my parent
-               - Iterate down through tree:
-               compute new size, shift ranks down, and update delta.
-            */
-            if (myrank == lchild) {
-                tree->tree_prev = parent + delta;
-            }
-            size = size - rightsize - 1;
-            delta = delta + rightsize;
-            myrank = myrank - rightsize;
-            parent = size - 1;
-
-        } else {
-            /* I belong to the right subtree:
-               - If I am the right child, compute real rank of my parent
-               - Iterate down through tree:
-               compute new size and parent,
-               but the delta and rank do not need to change.
-            */
-            if (myrank == rchild) {
-                tree->tree_prev = parent + delta;
-            }
-            size = rightsize;
-            parent = rchild;
+        size   = size - rightsize - 1;
+        delta  = delta + rightsize;
+        myrank = myrank - rightsize;
+        parent = size - 1;
+
+      } else {
+        /* I belong to the right subtree:
+           - If I am the right child, compute real rank of my parent
+           - Iterate down through tree:
+           compute new size and parent,
+           but the delta and rank do not need to change.
+        */
+        if (myrank == rchild) {
+          tree->tree_prev = parent + delta;
         }
+        size   = rightsize;
+        parent = rchild;
+      }
     }
 
     if (tree->tree_next[0] >= 0) { tree->tree_nextsize = 1; }
@@ -295,7 +297,7 @@ int ompi_coll_tuned_topo_destroy_tree( ompi_coll_tree_t** tree )
     ptr = *tree;
 
     delete ptr;
-    *tree = NULL;   /* mark tree as gone */
+    *tree = nullptr; /* mark tree as gone */
 
     return MPI_SUCCESS;
 }
@@ -338,7 +340,7 @@ ompi_coll_tuned_topo_build_bmtree( MPI_Comm comm,
     bmtree = new ompi_coll_tree_t;
     if (not bmtree) {
       XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory");
-      return NULL;
+      return nullptr;
     }
 
     bmtree->tree_bmtree   = 1;
@@ -370,7 +372,7 @@ ompi_coll_tuned_topo_build_bmtree( MPI_Comm comm,
         if (children==MAXTREEFANOUT) {
             XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, children);
             delete bmtree;
-            return NULL;
+            return nullptr;
         }
         bmtree->tree_next[children] = remote;
         mask <<= 1;
@@ -418,7 +420,7 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int
     if (not bmtree) {
       XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory");
       delete bmtree;
-      return NULL;
+      return nullptr;
     }
 
     bmtree->tree_bmtree   = 1;
@@ -443,7 +445,7 @@ ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int
         if (children == MAXTREEFANOUT) {
           XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, children);
           delete bmtree;
-          return NULL;
+          return nullptr;
         }
       }
       mask <<= 1;
@@ -490,7 +492,7 @@ ompi_coll_tuned_topo_build_chain( int fanout,
     if (not chain) {
       XBT_DEBUG("coll:tuned:topo:build_chain PANIC out of memory");
       fflush(stdout);
-      return NULL;
+      return nullptr;
     }
     for(i=0;i<fanout;i++) chain->tree_next[i] = -1;
 
index 7cad39a..3b1175a 100644 (file)
@@ -131,7 +131,7 @@ int gather__mvapich2_two_level(const void *sendbuf,
                                int root,
                                MPI_Comm comm)
 {
-  unsigned char* leader_gather_buf = NULL;
+  unsigned char* leader_gather_buf = nullptr;
   int comm_size, rank;
   int local_rank, local_size;
   int leader_comm_rank = -1, leader_comm_size = 0;
@@ -142,10 +142,10 @@ int gather__mvapich2_two_level(const void *sendbuf,
   MPI_Aint sendtype_extent = 0, recvtype_extent = 0; /* Datatype extent */
   MPI_Aint true_lb = 0, sendtype_true_extent = 0, recvtype_true_extent = 0;
   MPI_Comm shmem_comm, leader_comm;
-  unsigned char* tmp_buf = NULL;
+  unsigned char* tmp_buf = nullptr;
 
   // if not set (use of the algo directly, without mvapich2 selector)
-  if (MV2_Gather_intra_node_function == NULL)
+  if (MV2_Gather_intra_node_function == nullptr)
     MV2_Gather_intra_node_function = gather__mpich;
 
   if (comm->get_leaders_comm() == MPI_COMM_NULL) {
@@ -222,9 +222,9 @@ int gather__mvapich2_two_level(const void *sendbuf,
             } else {
               tmp_buf = smpi_get_tmp_sendbuffer(sendcnt * std::max(sendtype_extent, sendtype_true_extent) * local_size);
             }
-            if (tmp_buf == NULL) {
-                mpi_errno = MPI_ERR_OTHER;
-                return mpi_errno;
+            if (tmp_buf == nullptr) {
+              mpi_errno = MPI_ERR_OTHER;
+              return mpi_errno;
             }
         }
          /*while testing mpich2 gather test, we see that
@@ -268,8 +268,8 @@ int gather__mvapich2_two_level(const void *sendbuf,
      */
     if (not comm->is_uniform()) {
       if (local_rank == 0) {
-        int* displs   = NULL;
-        int* recvcnts = NULL;
+        int* displs   = nullptr;
+        int* recvcnts = nullptr;
         int* node_sizes;
         int i = 0;
         /* Node leaders have all the data. But, different nodes can have
@@ -288,7 +288,7 @@ int gather__mvapich2_two_level(const void *sendbuf,
             leader_gather_buf =
                 smpi_get_tmp_sendbuffer(sendcnt * std::max(sendtype_extent, sendtype_true_extent) * comm_size);
           }
-          if (leader_gather_buf == NULL) {
+          if (leader_gather_buf == nullptr) {
             mpi_errno = MPI_ERR_OTHER;
             return mpi_errno;
           }
@@ -345,9 +345,9 @@ int gather__mvapich2_two_level(const void *sendbuf,
                 /* The root of the Gather operation is not a node-level leader
                  */
                 leader_gather_buf = smpi_get_tmp_sendbuffer(nbytes * comm_size);
-                if (leader_gather_buf == NULL) {
-                    mpi_errno = MPI_ERR_OTHER;
-                    return mpi_errno;
+                if (leader_gather_buf == nullptr) {
+                  mpi_errno = MPI_ERR_OTHER;
+                  return mpi_errno;
                 }
             }
             if (root == leader_of_root) {
@@ -384,12 +384,12 @@ int gather__mvapich2_two_level(const void *sendbuf,
 
     /* check if multiple threads are calling this collective function */
     if (local_rank == 0 ) {
-        if (tmp_buf != NULL) {
-            smpi_free_tmp_buffer(tmp_buf);
-        }
-        if (leader_gather_buf != NULL) {
-            smpi_free_tmp_buffer(leader_gather_buf);
-        }
+      if (tmp_buf != nullptr) {
+        smpi_free_tmp_buffer(tmp_buf);
+      }
+      if (leader_gather_buf != nullptr) {
+        smpi_free_tmp_buffer(leader_gather_buf);
+      }
     }
 
     return (mpi_errno);
index f1fca99..3963e23 100644 (file)
@@ -76,7 +76,7 @@ int gather__ompi_binomial(const void* sbuf, int scount, MPI_Datatype sdtype, voi
           /* root is not on 0, allocate temp buffer for recv,
            * rotate data at the end */
           tempbuf = smpi_get_tmp_recvbuffer(rtrue_extent + (rcount * size - 1) * rextent);
-          if (NULL == tempbuf) {
+          if (nullptr == tempbuf) {
             err  = MPI_ERR_OTHER;
             line = __LINE__;
             goto err_hndl;
@@ -106,7 +106,7 @@ int gather__ompi_binomial(const void* sbuf, int scount, MPI_Datatype sdtype, voi
        * children, the most we need is half of the total data elements due
        * to the property of binomial tree */
       tempbuf = smpi_get_tmp_sendbuffer(strue_extent + (scount * size - 1) * sextent);
-      if (NULL == tempbuf) {
+      if (nullptr == tempbuf) {
         err  = MPI_ERR_OTHER;
         line = __LINE__;
         goto err_hndl;
@@ -188,11 +188,11 @@ int gather__ompi_binomial(const void* sbuf, int scount, MPI_Datatype sdtype, voi
     return MPI_SUCCESS;
 
  err_hndl:
-    if (NULL != tempbuf)
-      smpi_free_tmp_buffer(tempbuf);
+   if (nullptr != tempbuf)
+     smpi_free_tmp_buffer(tempbuf);
 
-    XBT_DEBUG("%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank);
-    return err;
+   XBT_DEBUG("%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank);
+   return err;
 }
 
 /*
@@ -271,10 +271,11 @@ int gather__ompi_linear_sync(const void *sbuf, int scount,
       char* ptmp;
       MPI_Request first_segment_req;
       MPI_Request* reqs = new (std::nothrow) MPI_Request[size];
-      if (NULL == reqs) {
+      if (nullptr == reqs) {
         ret  = -1;
         line = __LINE__;
-        goto error_hndl; }
+        goto error_hndl;
+      }
 
         typelng=rdtype->size();
         rdtype->extent(&lb, &extent);
index d2c91de..ffc0d25 100644 (file)
@@ -57,7 +57,7 @@ static int MPIR_Reduce_knomial_trace(int root, int reduce_knomial_factor,
     int mask=0x1, k, comm_size, src, rank, relative_rank, lroot=0;
     int orig_mask=0x1;
     int recv_iter=0, send_iter=0;
-    int *knomial_reduce_src_array=NULL;
+    int* knomial_reduce_src_array = nullptr;
     comm_size =  comm->size();
     rank = comm->rank();
 
@@ -135,7 +135,7 @@ int reduce__mvapich2_knomial(
     MPI_Aint true_lb, true_extent, extent;
     MPI_Status status;
     int recv_iter=0, dst=-1, expected_send_count, expected_recv_count;
-    int *src_array=NULL;
+    int* src_array = nullptr;
 
     if (count == 0) return MPI_SUCCESS;
 
@@ -207,7 +207,7 @@ int reduce__mvapich2_knomial(
         delete[] requests;
     }
 
-    if(src_array != NULL) {
+    if (src_array != nullptr) {
       delete[] src_array;
     }
 
index b52dcb2..b91ee79 100644 (file)
@@ -95,9 +95,9 @@ int reduce__mvapich2_two_level( const void *sendbuf,
     int intra_node_root=0;
 
     //if not set (use of the algo directly, without mvapich2 selector)
-    if(MV2_Reduce_function==NULL)
+    if (MV2_Reduce_function == nullptr)
       MV2_Reduce_function = reduce__mpich;
-    if(MV2_Reduce_intra_function==NULL)
+    if (MV2_Reduce_intra_function == nullptr)
       MV2_Reduce_intra_function = reduce__mpich;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
index ccdd68e..dec6161 100644 (file)
@@ -267,7 +267,11 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
 
             int creq = 0;
             MPI_Request* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs];
-            if (NULL == sreq) { line = __LINE__; ret = -1; goto error_hndl; }
+            if (nullptr == sreq) {
+              line = __LINE__;
+              ret  = -1;
+              goto error_hndl;
+            }
 
             /* post first group of requests */
             for (segindex = 0; segindex < max_outstanding_reqs; segindex++) {
@@ -520,14 +524,14 @@ int reduce__ompi_in_order_binary(const void *sendbuf, void *recvbuf,
 
         if ((root == rank) && (MPI_IN_PLACE == sendbuf)) {
           tmp_sendbuf = smpi_get_tmp_sendbuffer(text + (count - 1) * ext);
-          if (NULL == tmp_sendbuf) {
+          if (nullptr == tmp_sendbuf) {
             return MPI_ERR_INTERN;
           }
           Datatype::copy(recvbuf, count, datatype, tmp_sendbuf, count, datatype);
           use_this_sendbuf = tmp_sendbuf;
         } else if (io_root == rank) {
           tmp_recvbuf = smpi_get_tmp_recvbuffer(text + (count - 1) * ext);
-          if (NULL == tmp_recvbuf) {
+          if (nullptr == tmp_recvbuf) {
             return MPI_ERR_INTERN;
           }
           use_this_recvbuf = tmp_recvbuf;
index 208022e..c55af6c 100644 (file)
@@ -25,8 +25,8 @@ int reduce__scatter_gather(const void *sendbuf, void *recvbuf,
   int tag = COLL_TAG_REDUCE,temporary_buffer=0;
   unsigned char *send_ptr, *recv_ptr, *tmp_buf;
 
-  cnts = NULL;
-  disps = NULL;
+  cnts  = nullptr;
+  disps = nullptr;
 
   MPI_Aint extent;
 
index fc72566..e19c986 100644 (file)
@@ -93,9 +93,9 @@ int reduce_scatter__ompi_basic_recursivehalving(const void *sbuf,
     /* Allocate temporary receive buffer. */
     unsigned char* recv_buf_free = smpi_get_tmp_recvbuffer(buf_size);
     unsigned char* recv_buf      = recv_buf_free - lb;
-    if (NULL == recv_buf_free) {
-        err = MPI_ERR_OTHER;
-        goto cleanup;
+    if (nullptr == recv_buf_free) {
+      err = MPI_ERR_OTHER;
+      goto cleanup;
     }
 
     /* allocate temporary buffer for results */
@@ -279,8 +279,10 @@ int reduce_scatter__ompi_basic_recursivehalving(const void *sbuf,
 
  cleanup:
     delete[] disps;
-    if (NULL != recv_buf_free) smpi_free_tmp_buffer(recv_buf_free);
-    if (NULL != result_buf_free) smpi_free_tmp_buffer(result_buf_free);
+    if (nullptr != recv_buf_free)
+      smpi_free_tmp_buffer(recv_buf_free);
+    if (nullptr != result_buf_free)
+      smpi_free_tmp_buffer(result_buf_free);
 
     return err;
 }
@@ -355,10 +357,10 @@ int reduce_scatter__ompi_ring(const void *sbuf, void *rbuf, const int *rcounts,
 {
     int ret, line, rank, size, i, k, recv_from, send_to, total_count, max_block_count;
     int inbi;
-    unsigned char *tmpsend = NULL, *tmprecv = NULL, *accumbuf = NULL, *accumbuf_free = NULL;
-    unsigned char *inbuf_free[2] = {NULL, NULL}, *inbuf[2] = {NULL, NULL};
+    unsigned char *tmpsend = nullptr, *tmprecv = nullptr, *accumbuf = nullptr, *accumbuf_free = nullptr;
+    unsigned char *inbuf_free[2] = {nullptr, nullptr}, *inbuf[2] = {nullptr, nullptr};
     ptrdiff_t true_lb, true_extent, lb, extent, max_real_segsize;
-    MPI_Request reqs[2] = {NULL, NULL};
+    MPI_Request reqs[2] = {nullptr, nullptr};
 
     size = comm->size();
     rank = comm->rank();
@@ -401,15 +403,23 @@ int reduce_scatter__ompi_ring(const void *sbuf, void *rbuf, const int *rcounts,
     max_real_segsize = true_extent + (ptrdiff_t)(max_block_count - 1) * extent;
 
     accumbuf_free = smpi_get_tmp_recvbuffer(true_extent + (ptrdiff_t)(total_count - 1) * extent);
-    if (NULL == accumbuf_free) { ret = -1; line = __LINE__; goto error_hndl; }
+    if (nullptr == accumbuf_free) {
+      ret  = -1;
+      line = __LINE__;
+      goto error_hndl;
+    }
     accumbuf = accumbuf_free - lb;
 
     inbuf_free[0] = smpi_get_tmp_sendbuffer(max_real_segsize);
-    if (NULL == inbuf_free[0]) { ret = -1; line = __LINE__; goto error_hndl; }
+    if (nullptr == inbuf_free[0]) {
+      ret  = -1;
+      line = __LINE__;
+      goto error_hndl;
+    }
     inbuf[0] = inbuf_free[0] - lb;
     if (size > 2) {
       inbuf_free[1] = smpi_get_tmp_sendbuffer(max_real_segsize);
-      if (NULL == inbuf_free[1]) {
+      if (nullptr == inbuf_free[1]) {
         ret  = -1;
         line = __LINE__;
         goto error_hndl;
@@ -495,9 +505,12 @@ int reduce_scatter__ompi_ring(const void *sbuf, void *rbuf, const int *rcounts,
     if (ret < 0) { line = __LINE__; goto error_hndl; }
 
     delete[] displs;
-    if (NULL != accumbuf_free) smpi_free_tmp_buffer(accumbuf_free);
-    if (NULL != inbuf_free[0]) smpi_free_tmp_buffer(inbuf_free[0]);
-    if (NULL != inbuf_free[1]) smpi_free_tmp_buffer(inbuf_free[1]);
+    if (nullptr != accumbuf_free)
+      smpi_free_tmp_buffer(accumbuf_free);
+    if (nullptr != inbuf_free[0])
+      smpi_free_tmp_buffer(inbuf_free[0]);
+    if (nullptr != inbuf_free[1])
+      smpi_free_tmp_buffer(inbuf_free[1]);
 
     return MPI_SUCCESS;
 
@@ -505,9 +518,12 @@ int reduce_scatter__ompi_ring(const void *sbuf, void *rbuf, const int *rcounts,
     XBT_DEBUG( "%s:%4d\tRank %d Error occurred %d\n",
                  __FILE__, line, rank, ret);
     delete[] displs;
-    if (NULL != accumbuf_free) smpi_free_tmp_buffer(accumbuf_free);
-    if (NULL != inbuf_free[0]) smpi_free_tmp_buffer(inbuf_free[0]);
-    if (NULL != inbuf_free[1]) smpi_free_tmp_buffer(inbuf_free[1]);
+    if (nullptr != accumbuf_free)
+      smpi_free_tmp_buffer(accumbuf_free);
+    if (nullptr != inbuf_free[0])
+      smpi_free_tmp_buffer(inbuf_free[0]);
+    if (nullptr != inbuf_free[1])
+      smpi_free_tmp_buffer(inbuf_free[1]);
     return ret;
 }
 }
index a762ce1..b767491 100644 (file)
@@ -65,7 +65,7 @@ int scatter__mvapich2_two_level_direct(const void *sendbuf,
     int leader_root, leader_of_root = -1;
     MPI_Comm shmem_comm, leader_comm;
     //if not set (use of the algo directly, without mvapich2 selector)
-    if(MV2_Scatter_intra_function==NULL)
+    if (MV2_Scatter_intra_function == nullptr)
       MV2_Scatter_intra_function = scatter__mpich;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
@@ -142,8 +142,8 @@ int scatter__mvapich2_two_level_direct(const void *sendbuf,
 
         if (leader_comm_size > 1 && local_rank == 0) {
           if (not comm->is_uniform()) {
-            int* displs   = NULL;
-            int* sendcnts = NULL;
+            int* displs   = nullptr;
+            int* sendcnts = nullptr;
             int* node_sizes;
             int i      = 0;
             node_sizes = comm->get_non_uniform_map();
@@ -244,7 +244,7 @@ int scatter__mvapich2_two_level_binomial(const void *sendbuf,
 
 
     //if not set (use of the algo directly, without mvapich2 selector)
-    if(MV2_Scatter_intra_function==NULL)
+    if (MV2_Scatter_intra_function == nullptr)
       MV2_Scatter_intra_function = scatter__mpich;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
@@ -318,8 +318,8 @@ int scatter__mvapich2_two_level_binomial(const void *sendbuf,
 
         if (leader_comm_size > 1 && local_rank == 0) {
           if (not comm->is_uniform()) {
-            int* displs   = NULL;
-            int* sendcnts = NULL;
+            int* displs   = nullptr;
+            int* sendcnts = nullptr;
             int* node_sizes;
             int i      = 0;
             node_sizes = comm->get_non_uniform_map();
index ac8185c..95f7cd9 100644 (file)
@@ -21,7 +21,7 @@ int alltoall__mvapich2( const void *sendbuf, int sendcount,
                         MPI_Comm comm)
 {
 
-  if(mv2_alltoall_table_ppn_conf==NULL)
+  if (mv2_alltoall_table_ppn_conf == nullptr)
     init_mv2_alltoall_tables_stampede();
 
   int sendtype_size, recvtype_size, comm_size;
@@ -96,7 +96,7 @@ int allgather__mvapich2(const void *sendbuf, int sendcount, MPI_Datatype sendtyp
   recvtype_size=recvtype->size();
   nbytes = recvtype_size * recvcount;
 
-  if(mv2_allgather_table_ppn_conf==NULL)
+  if (mv2_allgather_table_ppn_conf == nullptr)
     init_mv2_allgather_tables_stampede();
 
   if(comm->get_leaders_comm()==MPI_COMM_NULL){
@@ -186,7 +186,7 @@ int gather__mvapich2(const void *sendbuf,
     MPI_Datatype recvtype,
     int root, MPI_Comm  comm)
 {
-  if(mv2_gather_thresholds_table==NULL)
+  if (mv2_gather_thresholds_table == nullptr)
     init_mv2_gather_tables_stampede();
 
   int mpi_errno = MPI_SUCCESS;
@@ -261,7 +261,7 @@ int allgatherv__mvapich2(const void *sendbuf, int sendcount, MPI_Datatype sendty
   int range_threshold = 0;
   long nbytes = 0;
 
-  if(mv2_allgatherv_thresholds_table==NULL)
+  if (mv2_allgatherv_thresholds_table == nullptr)
     init_mv2_allgatherv_tables_stampede();
 
   comm_size = comm->size();
@@ -332,7 +332,7 @@ int allreduce__mvapich2(const void *sendbuf,
       return MPI_SUCCESS;
   }
 
-  if (mv2_allreduce_thresholds_table == NULL)
+  if (mv2_allreduce_thresholds_table == nullptr)
     init_mv2_allreduce_tables_stampede();
 
   /* check if multiple threads are calling this collective function */
@@ -559,10 +559,10 @@ int bcast__mvapich2(void *buffer,
         zcpy_knomial_factor = mv2_pipelined_zcpy_knomial_factor;
     }
 
-    if(MV2_Bcast_intra_node_function == NULL) {
-        /* if tuning table do not have any intra selection, set func pointer to
-        ** default one for mcast intra node */
-        MV2_Bcast_intra_node_function = &MPIR_Shmem_Bcast_MV2;
+    if (MV2_Bcast_intra_node_function == nullptr) {
+      /* if tuning table do not have any intra selection, set func pointer to
+      ** default one for mcast intra node */
+      MV2_Bcast_intra_node_function = &MPIR_Shmem_Bcast_MV2;
     }
 
     /* Set value of pipeline segment size */
@@ -659,7 +659,7 @@ int reduce__mvapich2(const void *sendbuf,
     MPI_Datatype datatype,
     MPI_Op op, int root, MPI_Comm comm)
 {
-  if(mv2_reduce_thresholds_table == NULL)
+  if (mv2_reduce_thresholds_table == nullptr)
     init_mv2_reduce_tables_stampede();
 
   int mpi_errno = MPI_SUCCESS;
@@ -779,7 +779,7 @@ int reduce_scatter__mvapich2(const void *sendbuf, void *recvbuf, const int *recv
       0, nbytes = 0;
   int* disps          = new int[comm_size];
 
-  if(mv2_red_scat_thresholds_table==NULL)
+  if (mv2_red_scat_thresholds_table == nullptr)
     init_mv2_reduce_scatter_tables_stampede();
 
   bool is_commutative = (op == MPI_OP_NULL || op->is_commutative());
@@ -860,12 +860,12 @@ int scatter__mvapich2(const void *sendbuf,
   int conf_index = 0;
      MPI_Comm shmem_comm;
   //    MPID_Comm *shmem_commptr=NULL;
-  if(mv2_scatter_thresholds_table==NULL)
-    init_mv2_scatter_tables_stampede();
+     if (mv2_scatter_thresholds_table == nullptr)
+       init_mv2_scatter_tables_stampede();
 
-  if(comm->get_leaders_comm()==MPI_COMM_NULL){
-    comm->init_smp();
-  }
+     if (comm->get_leaders_comm() == MPI_COMM_NULL) {
+       comm->init_smp();
+     }
 
   comm_size = comm->size();
 
@@ -939,14 +939,14 @@ int scatter__mvapich2(const void *sendbuf,
       } else
 #endif /*#if defined(_MCST_SUPPORT_) */
         {
-          if(mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold + 1].
-              MV2_pt_Scatter_function != NULL) {
-              MV2_Scatter_function = mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold + 1]
-                                                                                                  .MV2_pt_Scatter_function;
-          } else {
-              /* Fallback! */
-              MV2_Scatter_function = &MPIR_Scatter_MV2_Binomial;
-          }
+        if (mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold + 1].MV2_pt_Scatter_function !=
+            nullptr) {
+          MV2_Scatter_function =
+              mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold + 1].MV2_pt_Scatter_function;
+        } else {
+          /* Fallback! */
+          MV2_Scatter_function = &MPIR_Scatter_MV2_Binomial;
+        }
         }
   }
 
index c385b97..955b9e3 100644 (file)
@@ -33,14 +33,14 @@ struct mv2_alltoall_tuning_table {
 };
 
 int (*MV2_Alltoall_function)(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
-                             MPI_Datatype recvtype, MPI_Comm comm_ptr) = NULL;
+                             MPI_Datatype recvtype, MPI_Comm comm_ptr) = nullptr;
 
 /* Indicates number of processes per node */
-int* mv2_alltoall_table_ppn_conf = NULL;
+int* mv2_alltoall_table_ppn_conf = nullptr;
 /* Indicates total number of configurations */
 int mv2_alltoall_num_ppn_conf                             = 1;
-int* mv2_size_alltoall_tuning_table                       = NULL;
-mv2_alltoall_tuning_table** mv2_alltoall_thresholds_table = NULL;
+int* mv2_size_alltoall_tuning_table                       = nullptr;
+mv2_alltoall_tuning_table** mv2_alltoall_thresholds_table = nullptr;
 
 #define MPIR_Alltoall_bruck_MV2 simgrid::smpi::alltoall__bruck
 #define MPIR_Alltoall_RD_MV2 simgrid::smpi::alltoall__rdb
@@ -51,9 +51,9 @@ mv2_alltoall_tuning_table** mv2_alltoall_thresholds_table = NULL;
 static void init_mv2_alltoall_tables_stampede()
 {
   int agg_table_sum                      = 0;
-  mv2_alltoall_tuning_table** table_ptrs = NULL;
+  mv2_alltoall_tuning_table** table_ptrs = nullptr;
   mv2_alltoall_num_ppn_conf              = 3;
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_alltoall_thresholds_table                      = new mv2_alltoall_tuning_table*[mv2_alltoall_num_ppn_conf];
   table_ptrs                                         = new mv2_alltoall_tuning_table*[mv2_alltoall_num_ppn_conf];
@@ -347,10 +347,10 @@ struct mv2_allgather_tuning_table {
 int (*MV2_Allgatherction)(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
                           MPI_Datatype recvtype, MPI_Comm comm);
 
-int* mv2_allgather_table_ppn_conf                           = NULL;
+int* mv2_allgather_table_ppn_conf                           = nullptr;
 int mv2_allgather_num_ppn_conf                              = 1;
-int* mv2_size_allgather_tuning_table                        = NULL;
-mv2_allgather_tuning_table** mv2_allgather_thresholds_table = NULL;
+int* mv2_size_allgather_tuning_table                        = nullptr;
+mv2_allgather_tuning_table** mv2_allgather_thresholds_table = nullptr;
 
 static int MPIR_Allgather_RD_Allgather_Comm_MV2(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
                                                 int recvcount, MPI_Datatype recvtype, MPI_Comm comm_ptr)
@@ -367,7 +367,7 @@ static void init_mv2_allgather_tables_stampede()
 {
   int agg_table_sum = 0;
 
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_allgather_num_ppn_conf                         = 3;
   mv2_allgather_thresholds_table                     = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf];
@@ -575,13 +575,13 @@ struct mv2_gather_tuning_table {
 };
 
 int mv2_size_gather_tuning_table                     = 7;
-mv2_gather_tuning_table* mv2_gather_thresholds_table = NULL;
+mv2_gather_tuning_table* mv2_gather_thresholds_table = nullptr;
 
 typedef int (*MV2_Gather_function_ptr)(const void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
                                        MPI_Datatype recvtype, int root, MPI_Comm comm);
 
-MV2_Gather_function_ptr MV2_Gather_inter_leader_function = NULL;
-MV2_Gather_function_ptr MV2_Gather_intra_node_function   = NULL;
+MV2_Gather_function_ptr MV2_Gather_inter_leader_function = nullptr;
+MV2_Gather_function_ptr MV2_Gather_intra_node_function   = nullptr;
 
 #define MPIR_Gather_MV2_Direct simgrid::smpi::gather__ompi_basic_linear
 #define MPIR_Gather_MV2_two_level_Direct simgrid::smpi::gather__mvapich2_two_level
@@ -590,7 +590,7 @@ MV2_Gather_function_ptr MV2_Gather_intra_node_function   = NULL;
 static void init_mv2_gather_tables_stampede()
 {
 
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_size_gather_tuning_table                       = 7;
   mv2_gather_thresholds_table                               = new mv2_gather_tuning_table[mv2_size_gather_tuning_table];
@@ -666,7 +666,7 @@ int (*MV2_Allgatherv_function)(const void* sendbuf, int sendcount, MPI_Datatype
                                const int* displs, MPI_Datatype recvtype, MPI_Comm comm);
 
 int mv2_size_allgatherv_tuning_table                         = 0;
-mv2_allgatherv_tuning_table* mv2_allgatherv_thresholds_table = NULL;
+mv2_allgatherv_tuning_table* mv2_allgatherv_thresholds_table = nullptr;
 
 #define MPIR_Allgatherv_Rec_Doubling_MV2 simgrid::smpi::allgatherv__mpich_rdb
 #define MPIR_Allgatherv_Bruck_MV2 simgrid::smpi::allgatherv__ompi_bruck
@@ -674,7 +674,7 @@ mv2_allgatherv_tuning_table* mv2_allgatherv_thresholds_table = NULL;
 
 static void init_mv2_allgatherv_tables_stampede()
 {
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_size_allgatherv_tuning_table                   = 6;
   mv2_allgatherv_thresholds_table = new mv2_allgatherv_tuning_table[mv2_size_allgatherv_tuning_table];
@@ -746,13 +746,13 @@ struct mv2_allreduce_tuning_table {
 };
 
 int (*MV2_Allreducection)(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
-                          MPI_Comm comm) = NULL;
+                          MPI_Comm comm) = nullptr;
 
 int (*MV2_Allreduce_intra_function)(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
-                                    MPI_Comm comm) = NULL;
+                                    MPI_Comm comm) = nullptr;
 
 int mv2_size_allreduce_tuning_table                        = 0;
-mv2_allreduce_tuning_table* mv2_allreduce_thresholds_table = NULL;
+mv2_allreduce_tuning_table* mv2_allreduce_thresholds_table = nullptr;
 
 static int MPIR_Allreduce_mcst_reduce_two_level_helper_MV2(const void* sendbuf, void* recvbuf, int count,
                                                            MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
@@ -786,7 +786,7 @@ static int MPIR_Allreduce_reduce_shmem_MV2(const void* sendbuf, void* recvbuf, i
 
 static void init_mv2_allreduce_tables_stampede()
 {
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_size_allreduce_tuning_table                    = 8;
   mv2_allreduce_thresholds_table                     = new mv2_allreduce_tuning_table[mv2_size_allreduce_tuning_table];
@@ -937,12 +937,12 @@ struct mv2_bcast_tuning_table {
 };
 
 int mv2_size_bcast_tuning_table                    = 0;
-mv2_bcast_tuning_table* mv2_bcast_thresholds_table = NULL;
+mv2_bcast_tuning_table* mv2_bcast_thresholds_table = nullptr;
 
-int (*MV2_Bcast_function)(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm_ptr) = NULL;
+int (*MV2_Bcast_function)(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm_ptr) = nullptr;
 
 int (*MV2_Bcast_intra_node_function)(void* buffer, int count, MPI_Datatype datatype, int root,
-                                     MPI_Comm comm_ptr) = NULL;
+                                     MPI_Comm comm_ptr) = nullptr;
 
 int zcpy_knomial_factor               = 2;
 int mv2_pipelined_zcpy_knomial_factor = -1;
@@ -970,7 +970,7 @@ int mv2_intra_node_knomial_factor     = 4;
 static void init_mv2_bcast_tables_stampede()
 {
   // Stampede,
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_size_bcast_tuning_table                        = 8;
   mv2_bcast_thresholds_table                         = new mv2_bcast_tuning_table[mv2_size_bcast_tuning_table];
@@ -1067,7 +1067,7 @@ static void init_mv2_bcast_tables_stampede()
        {{0, 8192, &MPIR_Shmem_Bcast_MV2, 8},
         {8192, 16384, &MPIR_Shmem_Bcast_MV2, 4},
         {16384, 524288, &MPIR_Shmem_Bcast_MV2, 2},
-        {524288, -1, NULL, -1}}},
+        {524288, -1, nullptr, -1}}},
       {256,
        8192,
        4,
@@ -1165,16 +1165,16 @@ struct mv2_reduce_tuning_table {
 };
 
 int mv2_size_reduce_tuning_table                     = 0;
-mv2_reduce_tuning_table* mv2_reduce_thresholds_table = NULL;
+mv2_reduce_tuning_table* mv2_reduce_thresholds_table = nullptr;
 
 int mv2_reduce_intra_knomial_factor = -1;
 int mv2_reduce_inter_knomial_factor = -1;
 
 int (*MV2_Reduce_function)(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
-                           MPI_Comm comm_ptr) = NULL;
+                           MPI_Comm comm_ptr) = nullptr;
 
-int (*MV2_Reduce_intra_function)(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
-                                 MPI_Comm comm_ptr) = NULL;
+int (*MV2_Reduce_intra_function)(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
+                                 int root, MPI_Comm comm_ptr) = nullptr;
 
 #define MPIR_Reduce_inter_knomial_wrapper_MV2 simgrid::smpi::reduce__mvapich2_knomial
 #define MPIR_Reduce_intra_knomial_wrapper_MV2 simgrid::smpi::reduce__mvapich2_knomial
@@ -1185,7 +1185,7 @@ int (*MV2_Reduce_intra_function)(const void* sendbuf, void* recvbuf, int count,
 
 static void init_mv2_reduce_tables_stampede()
 {
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   /*Stampede*/
   mv2_size_reduce_tuning_table = 8;
@@ -1392,7 +1392,7 @@ struct mv2_red_scat_tuning_table {
 };
 
 int mv2_size_red_scat_tuning_table                       = 0;
-mv2_red_scat_tuning_table* mv2_red_scat_thresholds_table = NULL;
+mv2_red_scat_tuning_table* mv2_red_scat_thresholds_table = nullptr;
 
 int (*MV2_Red_scat_function)(const void* sendbuf, void* recvbuf, const int* recvcnts, MPI_Datatype datatype, MPI_Op op,
                              MPI_Comm comm_ptr);
@@ -1409,7 +1409,7 @@ static int MPIR_Reduce_Scatter_Basic_MV2(const void* sendbuf, void* recvbuf, con
 
 static void init_mv2_reduce_scatter_tables_stampede()
 {
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
   mv2_size_red_scat_tuning_table                     = 6;
   mv2_red_scat_thresholds_table                      = new mv2_red_scat_tuning_table[mv2_size_red_scat_tuning_table];
@@ -1484,16 +1484,16 @@ struct mv2_scatter_tuning_table {
   mv2_scatter_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
 };
 
-int* mv2_scatter_table_ppn_conf                         = NULL;
+int* mv2_scatter_table_ppn_conf                         = nullptr;
 int mv2_scatter_num_ppn_conf                            = 1;
-int* mv2_size_scatter_tuning_table                      = NULL;
-mv2_scatter_tuning_table** mv2_scatter_thresholds_table = NULL;
+int* mv2_size_scatter_tuning_table                      = nullptr;
+mv2_scatter_tuning_table** mv2_scatter_thresholds_table = nullptr;
 
 int (*MV2_Scatter_function)(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
-                            MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;
+                            MPI_Datatype recvtype, int root, MPI_Comm comm) = nullptr;
 
-int (*MV2_Scatter_intra_function)(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
-                                  MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;
+int (*MV2_Scatter_intra_function)(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
+                                  int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) = nullptr;
 int MPIR_Scatter_mcst_wrap_MV2(const void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
                                MPI_Datatype recvtype, int root, MPI_Comm comm_ptr);
 
@@ -1510,7 +1510,7 @@ int MPIR_Scatter_mcst_wrap_MV2(const void* sendbuf, int sendcnt, MPI_Datatype se
 
 static void init_mv2_scatter_tables_stampede()
 {
-  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == NULL)
+  if (simgrid::smpi::colls::smpi_coll_cleanup_callback == nullptr)
     simgrid::smpi::colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
 
   int agg_table_sum = 0;
index 90ac8da..4526b03 100644 (file)
@@ -81,7 +81,7 @@ template <typename T> int Keyval::keyval_free(int* keyval){
 /* See MPI-1, 5.7.1.  Freeing the keyval does not remove it if it
          * is in use in an attribute */
   smpi_key_elem elem = T::keyvals_.at(*keyval);
-  if(elem==0){
+  if (elem == nullptr) {
     return MPI_ERR_ARG;
   }
   if(elem->refcount==1){
index 1cadb65..cb641b1 100644 (file)
@@ -90,7 +90,7 @@ static const char* instr_find_color(const char* c_state)
     return smpi_colors.find(state)->second.c_str();
   }
   for (const auto& pair : smpi_colors) { // Is an entry of our map a substring of this state name?
-    if (std::strstr(state.c_str(), pair.first.c_str()) != 0)
+    if (std::strstr(state.c_str(), pair.first.c_str()) != nullptr)
       return pair.second.c_str();
   }
 
index c0e43d7..1c1d9c9 100644 (file)
@@ -367,7 +367,7 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of
 
   XBT_DEBUG("Copy %" PRIdMAX " bytes into %s", static_cast<intmax_t>(fdin_size), target.c_str());
 #if SG_HAVE_SENDFILE
-  ssize_t sent_size = sendfile(fdout, fdin, NULL, fdin_size);
+  ssize_t sent_size = sendfile(fdout, fdin, nullptr, fdin_size);
   if (sent_size == fdin_size) {
     close(fdin);
     close(fdout);
index c984b99..538a85e 100644 (file)
@@ -178,7 +178,7 @@ void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int
 
 
   /* First reserve memory area */
-  void* allocated_ptr = mmap(NULL, allocated_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+  void* allocated_ptr = mmap(nullptr, allocated_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 
   xbt_assert(allocated_ptr != MAP_FAILED, "Failed to allocate %zuMiB of memory. Run \"sysctl vm.overcommit_memory=1\" as root "
                                 "to allow big allocations.\n",
index 99badd8..ca295f3 100644 (file)
@@ -1178,7 +1178,7 @@ int Request::grequest_start(MPI_Grequest_query_function* query_fn, MPI_Grequest_
 
 int Request::grequest_complete(MPI_Request request)
 {
-  if ((!(request->flags_ & MPI_REQ_GENERALIZED)) || request->generalized_funcs->mutex==NULL) 
+  if ((!(request->flags_ & MPI_REQ_GENERALIZED)) || request->generalized_funcs->mutex == nullptr)
     return MPI_ERR_REQUEST;
   request->generalized_funcs->mutex->lock();
   request->flags_ |= MPI_REQ_COMPLETE; // in case wait would be called after complete
index 390f78e..9cf535d 100644 (file)
@@ -96,9 +96,9 @@ Win::~Win(){
 
 int Win::attach(void* /*base*/, MPI_Aint size)
 {
-  if (not(base_ == MPI_BOTTOM || base_ == 0))
+  if (not(base_ == MPI_BOTTOM || base_ == nullptr))
     return MPI_ERR_ARG;
-  base_=0;//actually the address will be given in the RMA calls, as being the disp.
+  base_ = nullptr; // actually the address will be given in the RMA calls, as being the disp.
   size_+=size;
   return MPI_SUCCESS;
 }
index b6835cd..6ecd3a1 100644 (file)
@@ -377,7 +377,7 @@ LinkNS3::LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwid
 
     ns3::NetDeviceContainer netA;
     WifiZone* zone = WifiZone::by_name(name);
-    xbt_assert(zone != 0, "Link name '%s' does not match the 'wifi_link' property of a host.", name.c_str());
+    xbt_assert(zone != nullptr, "Link name '%s' does not match the 'wifi_link' property of a host.", name.c_str());
     NetPointNs3* netpoint_ns3 = zone->get_host()->get_netpoint()->extension<NetPointNs3>();
 
     wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode",
index ebff56b..4b7e9b6 100644 (file)
@@ -75,7 +75,7 @@ static void send_cb(ns3::Ptr<ns3::Socket> sock, uint32_t txSpace)
                 flow->remaining_);
       return;
     }
-    int amountSent = sock->Send(0, toWrite, 0);
+    int amountSent = sock->Send(nullptr, toWrite, 0);
 
     xbt_assert(amountSent > 0, "Since TxAvailable>0, amountSent should also >0");
     flow->buffered_bytes_ += amountSent;
index af9b3eb..e1f4d6b 100644 (file)
@@ -272,7 +272,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
   XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
   if (cluster->router_id.empty())
     cluster->router_id = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix;
-  current_as->router_ = sg_platf_new_router(cluster->router_id, NULL);
+  current_as->router_ = sg_platf_new_router(cluster->router_id, nullptr);
 
   //Make the backbone
   if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) {
index 248d12d..57eced3 100644 (file)
@@ -162,7 +162,7 @@ std::vector<VmMap> get_memory_map(pid_t pid)
   /* to be returned. */
   std::string path = std::string("/proc/") + std::to_string(pid) + "/maps";
   std::ifstream fp;
-  fp.rdbuf()->pubsetbuf(0, 0);
+  fp.rdbuf()->pubsetbuf(nullptr, 0);
   fp.open(path);
   if (not fp) {
     std::perror("open failed");
index 96bb428..e110eec 100644 (file)
@@ -20,7 +20,7 @@ static void computation_fun()
   exec->wait();
   XBT_INFO("%s:%s Exec 1 complete %g", host_name, pr_name, simgrid::s4u::Engine::get_clock() - clock_sta);
 
-  exec = NULL;
+  exec = nullptr;
 
   simgrid::s4u::this_actor::sleep_for(1);
 
index 4ba0a96..acf3f54 100644 (file)
@@ -29,7 +29,7 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
   auto* Sys = new simgrid::kernel::lmm::System(false);
 
   for (int i = 0; i < nb_cnst; i++) {
-    cnst[i] = Sys->constraint_new(NULL, simgrid::xbt::random::uniform_real(0.0, 10.0));
+    cnst[i] = Sys->constraint_new(nullptr, simgrid::xbt::random::uniform_real(0.0, 10.0));
     int l;
     if (rate_no_limit > simgrid::xbt::random::uniform_real(0.0, 1.0)) {
       // Look at what happens when there is no concurrency limit
@@ -42,7 +42,7 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
   }
 
   for (int i = 0; i < nb_var; i++) {
-    var[i] = Sys->variable_new(NULL, 1.0, -1.0, nb_elem);
+    var[i] = Sys->variable_new(nullptr, 1.0, -1.0, nb_elem);
     //Have a few variables with a concurrency share of two (e.g. cross-traffic in some cases)
     short concurrency_share = 1 + static_cast<short>(simgrid::xbt::random::uniform_int(0, max_share - 1));
     var[i]->set_concurrency_share(concurrency_share);
index d77e012..2d50a4e 100644 (file)
@@ -39,7 +39,7 @@ int main(int argc, char**argv)
   unsigned long mask = ~((unsigned long)xbt_pagesize - 1);
   auto* addr         = reinterpret_cast<void*>(((unsigned long)sbrk(0) + BUFFSIZE) & mask);
   heapA = xbt_mheap_new(-1, addr);
-  if (heapA == NULL) {
+  if (heapA == nullptr) {
     perror("attach 1 failed");
     fprintf(stderr, "bye\n");
     exit(1);
index 789ee42..6b19832 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char* argv[])
   }
   timeout = atof(argv[2]);
   if (argc == 4)
-    modes = static_cast<unsigned>(strtoul(argv[2], NULL, 0));
+    modes = static_cast<unsigned>(strtoul(argv[2], nullptr, 0));
 
   XBT_INFO("Parmap benchmark with %d workers (modes = %#x)...", nthreads, modes);
   XBT_INFO("%s", "");