Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SIMIX] NULL -> nullptr substitution
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Wed, 8 Jun 2016 21:20:59 +0000 (23:20 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 9 Jun 2016 07:39:07 +0000 (09:39 +0200)
I used the following command: (the '**' means recursion in ZSH)
sed -i -e 's/\([^_]\s*\)NULL/\1nullptr/g' src/**/*.cpp

We check for the underscore to avoid replacing MPI_*_NULL

15 files changed:
src/simix/ContextRaw.cpp
src/simix/ContextThread.cpp
src/simix/ContextUnix.cpp
src/simix/SynchroComm.cpp
src/simix/SynchroExec.cpp
src/simix/SynchroSleep.cpp
src/simix/libsmx.cpp
src/simix/smx_deployment.cpp
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/simix/smx_process.cpp
src/simix/smx_synchro.cpp
src/simix/smx_vm.cpp

index 4a34afa..a11741f 100644 (file)
@@ -406,7 +406,7 @@ void RawContext::suspend_parallel()
   smx_process_t next_work = (smx_process_t) xbt_parmap_next(raw_parmap);
   RawContext* next_context = nullptr;
 
-  if (next_work != NULL) {
+  if (next_work != nullptr) {
     /* there is a next process to resume */
     XBT_DEBUG("Run next process");
     next_context = (RawContext*) next_work->context;
index 49ba1b0..dd82a17 100644 (file)
@@ -112,7 +112,7 @@ ThreadContext::ThreadContext(std::function<void()> code,
     /* NOTE: The first argument to xbt_os_thread_create used to be the process *
     * name, but now the name is stored at SIMIX level, so we pass a null  */
     this->thread_ =
-      xbt_os_thread_create(NULL,
+      xbt_os_thread_create(nullptr,
         maestro ? ThreadContext::maestro_wrapper : ThreadContext::wrapper,
         this, this);
     /* wait the starting of the newly created process */
@@ -201,7 +201,7 @@ void ThreadContext::stop()
   // Signal to the maestro that it has finished:
   xbt_os_sem_release(this->end_);
 
-  xbt_os_thread_exit(NULL);
+  xbt_os_thread_exit(nullptr);
 }
 
 void ThreadContext::suspend()
index 922631f..02b3a6e 100644 (file)
@@ -216,7 +216,7 @@ UContext::UContext(std::function<void()> code,
     this->uc_.uc_stack.ss_size = sg_makecontext_stack_size(smx_context_usable_stack_size);
     simgrid_makecontext(&this->uc_, smx_ctx_sysv_wrapper, this);
   } else {
-    if (process != NULL && sysv_maestro_context == NULL)
+    if (process != nullptr && sysv_maestro_context == nullptr)
       sysv_maestro_context = this;
   }
 
@@ -351,7 +351,7 @@ void ParallelUContext::suspend()
   // Will contain the next soul to run, either simulated or initial minion's one
   ucontext_t* next_stack;
 
-  if (next_work != NULL) {
+  if (next_work != nullptr) {
     // There is a next soul to embody (ie, a next process to resume)
     XBT_DEBUG("Run next process");
     next_context = (ParallelUContext*) next_work->context;
index 994583e..e97b18f 100644 (file)
@@ -14,8 +14,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_network);
 simgrid::simix::Comm::Comm(e_smx_comm_type_t _type) {
   state = SIMIX_WAITING;
   this->type = _type;
-  src_data=NULL;
-  dst_data=NULL;
+  src_data=nullptr;
+  dst_data=nullptr;
 
   XBT_DEBUG("Create communicate synchro %p", this);
 }
@@ -31,7 +31,7 @@ simgrid::simix::Comm::~Comm()
      * we have to free the buffer */
     if (clean_fun)
       clean_fun(src_buff);
-    src_buff = NULL;
+    src_buff = nullptr;
   }
 
   if(mbox)
@@ -96,17 +96,17 @@ void simgrid::simix::Comm::cleanupSurf()
 {
   if (surf_comm){
     surf_comm->unref();
-    surf_comm = NULL;
+    surf_comm = nullptr;
   }
 
   if (src_timeout){
     src_timeout->unref();
-    src_timeout = NULL;
+    src_timeout = nullptr;
   }
 
   if (dst_timeout){
     dst_timeout->unref();
-    dst_timeout = NULL;
+    dst_timeout = nullptr;
   }
 }
 
index 8ab8f2e..99d2b74 100644 (file)
@@ -55,7 +55,7 @@ void simgrid::simix::Exec::post()
 
   if (surf_exec) {
     surf_exec->unref();
-    surf_exec = NULL;
+    surf_exec = nullptr;
   }
 
   /* If there are simcalls associated with the synchro, then answer them */
index 579f06d..febf52d 100644 (file)
@@ -46,7 +46,7 @@ void simgrid::simix::Sleep::post()
       simcall->issuer->context->iwannadie = 1;
     }
     simcall_process_sleep__set__result(simcall, state);
-    simcall->issuer->waiting_synchro = NULL;
+    simcall->issuer->waiting_synchro = nullptr;
     if (simcall->issuer->suspended) {
       XBT_DEBUG("Wait! This process is suspended and can't wake up now.");
       simcall->issuer->suspended = 0;
index 794909f..8e07b0c 100644 (file)
@@ -109,7 +109,7 @@ smx_synchro_t simcall_execution_parallel_start(const char *name,
   /* checking for infinite values */
   for (i = 0 ; i < host_nb ; ++i) {
     xbt_assert(std::isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i);
-    if (bytes_amount != NULL) {
+    if (bytes_amount != nullptr) {
       for (j = 0 ; j < host_nb ; ++j) {
         xbt_assert(std::isfinite(bytes_amount[i + host_nb * j]),
                    "bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j);
@@ -357,9 +357,9 @@ void simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t d
  *
  * The structure and the corresponding thread are created and put in the list of ready processes.
  *
- * \param name a name for the process. It is for user-level information and can be NULL.
+ * \param name a name for the process. It is for user-level information and can be nullptr.
  * \param code the main function of the process
- * \param data a pointer to any data one may want to attach to the new object. It is for user-level information and can be NULL.
+ * \param data a pointer to any data one may want to attach to the new object. It is for user-level information and can be nullptr.
  * It can be retrieved with the function \ref simcall_process_get_data.
  * \param hostname name of the host where the new agent is executed.
  * \param kill_time time when the process is killed
@@ -540,7 +540,7 @@ void simcall_process_set_kill_time(smx_process_t process, double kill_time)
     kill_time, process->name.c_str(), sg_host_get_name(process->host));
   process->kill_timer = SIMIX_timer_set(kill_time, [=] {
     simix_global->kill_process_function(process);
-    process->kill_timer=NULL;
+    process->kill_timer=nullptr;
   });
 }
 /**
@@ -675,7 +675,7 @@ smx_mailbox_t simcall_mbox_get_by_name(const char *name)
  *  \ingroup simix_mbox_management
  *  \brief returns the communication at the head of the rendez-vous
  *  \param mbox The rendez-vous point
- *  \return The communication or NULL if empty
+ *  \return The communication or nullptr if empty
  */
 smx_synchro_t simcall_mbox_front(smx_mailbox_t mbox)
 {
@@ -706,11 +706,11 @@ void simcall_comm_send(smx_process_t sender, smx_mailbox_t mbox, double task_siz
 
   if (MC_is_active() || MC_record_replay_is_active()) {
     /* the model-checker wants two separate simcalls */
-    smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */
+    smx_synchro_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
     comm = simcall_comm_isend(sender, mbox, task_size, rate,
-        src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0);
+        src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
     simcall_comm_wait(comm, timeout);
-    comm = NULL;
+    comm = nullptr;
   }
   else {
     simcall_BODY_comm_send(sender, mbox, task_size, rate, src_buff, src_buff_size,
@@ -753,11 +753,11 @@ void simcall_comm_recv(smx_process_t receiver, smx_mailbox_t mbox, void *dst_buf
 
   if (MC_is_active() || MC_record_replay_is_active()) {
     /* the model-checker wants two separate simcalls */
-    smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */
+    smx_synchro_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
     comm = simcall_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
                               match_fun, copy_data_fun, data, rate);
     simcall_comm_wait(comm, timeout);
-    comm = NULL;
+    comm = nullptr;
   }
   else {
     simcall_BODY_comm_recv(receiver, mbox, dst_buff, dst_buff_size,
@@ -836,7 +836,7 @@ void simcall_comm_wait(smx_synchro_t comm, double timeout)
  */
 void simcall_set_category(smx_synchro_t synchro, const char *category)
 {
-  if (category == NULL) {
+  if (category == nullptr) {
     return;
   }
   simcall_BODY_set_category(synchro, category);
index 4edcc9d..1e12265 100644 (file)
@@ -67,10 +67,10 @@ void SIMIX_launch_application(const char *file)
 void SIMIX_function_register(const char *name, xbt_main_func_t code)
 {
   xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_function_register.");
-  xbt_dict_set(simix_global->registered_functions, name, (void*) code, NULL);
+  xbt_dict_set(simix_global->registered_functions, name, (void*) code, nullptr);
 }
 
-static xbt_main_func_t default_function = NULL;
+static xbt_main_func_t default_function = nullptr;
 /**
  * \brief Registers a #xbt_main_func_t code as default value.
  *
@@ -87,14 +87,14 @@ void SIMIX_function_register_default(xbt_main_func_t code)
 /**
  * \brief Gets a #smx_process_t code from the global table.
  *
- * Gets a code function from the global table. Returns NULL if there are no function registered with the name.
+ * Gets a code function from the global table. Returns nullptr if there are no function registered with the name.
  * This table is then used by #SIMIX_launch_application.
  * \param name the reference name of the function.
- * \return The #smx_process_t or NULL.
+ * \return The #smx_process_t or nullptr.
  */
 xbt_main_func_t SIMIX_get_registered_function(const char *name)
 {
-  xbt_main_func_t res = NULL;
+  xbt_main_func_t res = nullptr;
   xbt_assert(simix_global,
               "SIMIX_global_init has to be called before SIMIX_get_registered_function.");
 
@@ -130,7 +130,7 @@ void SIMIX_process_set_function(const char *process_host,
   xbt_dynar_foreach(arguments, i, arg) {
     process.argv[i + 1] = xbt_strdup(arg);
   }
-  process.argv[process.argc] = NULL;
+  process.argv[process.argc] = nullptr;
 
   xbt_main_func_t parse_code = SIMIX_get_registered_function(process_function);
   xbt_assert(parse_code, "Function '%s' unknown", process_function);
index 9ba653b..e79e69b 100644 (file)
@@ -44,8 +44,8 @@
 XBT_LOG_NEW_CATEGORY(simix, "All SIMIX categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix, "Logging specific to SIMIX (kernel)");
 
-smx_global_t simix_global = NULL;
-static xbt_heap_t simix_timers = NULL;
+smx_global_t simix_global = nullptr;
+static xbt_heap_t simix_timers = nullptr;
 
 /** @brief Timer datatype */
 typedef struct s_smx_timer {
@@ -57,7 +57,7 @@ typedef struct s_smx_timer {
     : date(date), callback(std::move(callback)) {}
 } s_smx_timer_t;
 
-void (*SMPI_switch_data_segment)(int) = NULL;
+void (*SMPI_switch_data_segment)(int) = nullptr;
 
 int _sg_do_verbose_exit = 1;
 static void inthandler(int ignored)
@@ -127,7 +127,7 @@ static void install_segvhandler(void)
   if (!(old_stack.ss_flags & SS_DISABLE)) {
     XBT_DEBUG("An alternate stack was already installed (sp=%p, size=%zd, flags=%x). Restore it.",
               old_stack.ss_sp, old_stack.ss_size, old_stack.ss_flags);
-    sigaltstack(&old_stack, NULL);
+    sigaltstack(&old_stack, nullptr);
   }
 
   struct sigaction action, old_action;
@@ -143,7 +143,7 @@ static void install_segvhandler(void)
     XBT_DEBUG("A signal handler was already installed for SIGSEGV (%p). Restore it.",
              (old_action.sa_flags & SA_SIGINFO) ?
              (void*)old_action.sa_sigaction : (void*)old_action.sa_handler);
-    sigaction(SIGSEGV, &old_action, NULL);
+    sigaction(SIGSEGV, &old_action, nullptr);
   }
 }
 
@@ -157,7 +157,7 @@ double SIMIX_timer_next(void)
 
 static void kill_process(smx_process_t process)
 {
-  SIMIX_process_kill(process, NULL);
+  SIMIX_process_kill(process, nullptr);
 }
 
 static std::function<void()> maestro_code;
@@ -197,13 +197,13 @@ void SIMIX_global_init(int *argc, char **argv)
     simix_global = xbt_new0(s_smx_global_t, 1);
 
     simgrid::simix::Process proc;
-    simix_global->process_to_run = xbt_dynar_new(sizeof(smx_process_t), NULL);
-    simix_global->process_that_ran = xbt_dynar_new(sizeof(smx_process_t), NULL);
+    simix_global->process_to_run = xbt_dynar_new(sizeof(smx_process_t), nullptr);
+    simix_global->process_that_ran = xbt_dynar_new(sizeof(smx_process_t), nullptr);
     simix_global->process_list = xbt_swag_new(xbt_swag_offset(proc, process_hookup));
     simix_global->process_to_destroy = xbt_swag_new(xbt_swag_offset(proc, destroy_hookup));
 
-    simix_global->maestro_process = NULL;
-    simix_global->registered_functions = xbt_dict_new_homogeneous(NULL);
+    simix_global->maestro_process = nullptr;
+    simix_global->registered_functions = xbt_dict_new_homogeneous(nullptr);
 
     simix_global->create_process_function = &SIMIX_process_create;
     simix_global->kill_process_function = &kill_process;
@@ -239,9 +239,9 @@ void SIMIX_global_init(int *argc, char **argv)
       const char* name = storage->getName();
       // TODO, create sg_storage_by_name
       sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, name);
-      xbt_assert(s != NULL, "Storage not found for name %s", name);
+      xbt_assert(s != nullptr, "Storage not found for name %s", name);
 
-      SIMIX_storage_create(name, s, NULL);
+      SIMIX_storage_create(name, s, nullptr);
     });
 
     SIMIX_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, SIMIX_storage_destroy);
@@ -283,18 +283,18 @@ void SIMIX_clean(void)
   SIMIX_mailbox_exit();
 
   xbt_heap_free(simix_timers);
-  simix_timers = NULL;
+  simix_timers = nullptr;
   /* Free the remaining data structures */
   xbt_dynar_free(&simix_global->process_to_run);
   xbt_dynar_free(&simix_global->process_that_ran);
   xbt_swag_free(simix_global->process_to_destroy);
   xbt_swag_free(simix_global->process_list);
-  simix_global->process_list = NULL;
-  simix_global->process_to_destroy = NULL;
+  simix_global->process_list = nullptr;
+  simix_global->process_to_destroy = nullptr;
   xbt_dict_free(&(simix_global->registered_functions));
 
   xbt_os_mutex_destroy(simix_global->mutex);
-  simix_global->mutex = NULL;
+  simix_global->mutex = nullptr;
 
   /* Let's free maestro now */
   delete simix_global->maestro_process->context;
@@ -302,7 +302,7 @@ void SIMIX_clean(void)
   xbt_free(simix_global->maestro_process->running_ctx);
   simix_global->maestro_process->running_ctx = nullptr;
   delete simix_global->maestro_process;
-  simix_global->maestro_process = NULL;
+  simix_global->maestro_process = nullptr;
 
   /* Restore the default exception setup */
   __xbt_running_ctx_fetch = &__xbt_ex_ctx_default;
@@ -314,7 +314,7 @@ void SIMIX_clean(void)
   surf_exit();
 
   xbt_free(simix_global);
-  simix_global = NULL;
+  simix_global = nullptr;
 
   return;
 }
@@ -449,7 +449,7 @@ void SIMIX_run(void)
         XBT_DEBUG("Handling process whose action terminated normally");
         while ((action = surf_model_extract_done_action_set(model))) {
           XBT_DEBUG("   Handling Action %p",action);
-          if (action->getData() == NULL)
+          if (action->getData() == nullptr)
             XBT_DEBUG("probably vcpu's action %p, skip", action);
           else
             SIMIX_simcall_exit((smx_synchro_t) action->getData());
@@ -493,7 +493,7 @@ void SIMIX_run(void)
       XBT_DEBUG("Handling process whose action terminated normally");
       while ((action = surf_model_extract_done_action_set(model))) {
         XBT_DEBUG("   Handling Action %p",action);
-        if (action->getData() == NULL)
+        if (action->getData() == nullptr)
           XBT_DEBUG("probably vcpu's action %p, skip", action);
         else
           SIMIX_simcall_exit((smx_synchro_t) action->getData());
@@ -501,7 +501,7 @@ void SIMIX_run(void)
     }
 
     /* Autorestart all process */
-    char *hostname = NULL;
+    char *hostname = nullptr;
     xbt_dynar_foreach(host_that_restart,iter,hostname) {
       XBT_INFO("Restart processes on host: %s",hostname);
       SIMIX_host_autorestart(sg_host_by_name(hostname));
@@ -554,7 +554,7 @@ void SIMIX_timer_remove(smx_timer_t timer) {
   xbt_heap_rm_elm(simix_timers, timer, timer->date);
 }
 
-/** @brief Returns the date at which the timer will trigger (or 0 if NULL timer) */
+/** @brief Returns the date at which the timer will trigger (or 0 if nullptr timer) */
 double SIMIX_timer_get_date(smx_timer_t timer) {
   return timer?timer->date:0;
 }
@@ -603,11 +603,11 @@ void SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t
 
 void SIMIX_display_process_status(void)
 {
-  if (simix_global->process_list == NULL) {
+  if (simix_global->process_list == nullptr) {
     return;
   }
 
-  smx_process_t process = NULL;
+  smx_process_t process = nullptr;
   int nbprocess = xbt_swag_size(simix_global->process_list);
 
   XBT_INFO("%d processes are still running, waiting for something.", nbprocess);
@@ -668,5 +668,5 @@ xbt_dict_t SIMIX_asr_get_properties(const char *name)
 
 int SIMIX_is_maestro()
 {
-  return simix_global==NULL /*SimDag*/|| SIMIX_process_self() == simix_global->maestro_process;
+  return simix_global==nullptr /*SimDag*/|| SIMIX_process_self() == simix_global->maestro_process;
 }
index 3b17a20..12aaf1b 100644 (file)
@@ -34,7 +34,7 @@ void SIMIX_host_on(sg_host_t h)
 {
   smx_host_priv_t host = sg_host_simix(h);
 
-  xbt_assert((host != NULL), "Invalid parameters");
+  xbt_assert((host != nullptr), "Invalid parameters");
 
   if (h->isOff()) {
     simgrid::surf::HostImpl* surf_host = h->extension<simgrid::surf::HostImpl>();
@@ -48,16 +48,16 @@ void SIMIX_host_on(sg_host_t h)
       if (simix_global->create_process_function) {
         simix_global->create_process_function(arg->name.c_str(),
                                               arg->code,
-                                              NULL,
+                                              nullptr,
                                               arg->hostname,
                                               arg->kill_time,
                                               arg->properties,
                                               arg->auto_restart,
-                                              NULL);
+                                              nullptr);
       } else {
         simcall_process_create(arg->name.c_str(),
                                arg->code,
-                               NULL,
+                               nullptr,
                                arg->hostname,
                                arg->kill_time,
                                arg->properties,
@@ -72,7 +72,7 @@ void SIMIX_host_off(sg_host_t h, smx_process_t issuer)
 {
   smx_host_priv_t host = sg_host_simix(h);
 
-  xbt_assert((host != NULL), "Invalid parameters");
+  xbt_assert((host != nullptr), "Invalid parameters");
 
   if (h->isOn()) {
     simgrid::surf::HostImpl* surf_host = h->extension<simgrid::surf::HostImpl>();
@@ -80,7 +80,7 @@ void SIMIX_host_off(sg_host_t h, smx_process_t issuer)
 
     /* Clean Simulator data */
     if (xbt_swag_size(host->process_list) != 0) {
-      smx_process_t process = NULL;
+      smx_process_t process = nullptr;
       xbt_swag_foreach(process, host->process_list) {
         SIMIX_process_kill(process, issuer);
         XBT_DEBUG("Killing %s on %s by %s",
@@ -102,13 +102,13 @@ void SIMIX_host_destroy(void *h)
 {
   smx_host_priv_t host = (smx_host_priv_t) h;
 
-  xbt_assert((host != NULL), "Invalid parameters");
+  xbt_assert((host != nullptr), "Invalid parameters");
 
   /* Clean Simulator data */
   if (xbt_swag_size(host->process_list) != 0) {
     char *msg = xbt_strdup("Shutting down host, but it's not empty:");
     char *tmp;
-    smx_process_t process = NULL;
+    smx_process_t process = nullptr;
 
     xbt_swag_foreach(process, host->process_list) {
       tmp = bprintf("%s\n\t%s", msg, process->name.c_str());
@@ -130,14 +130,14 @@ void SIMIX_host_destroy(void *h)
 sg_host_t SIMIX_host_self(void)
 {
   smx_process_t process = SIMIX_process_self();
-  return (process == NULL) ? NULL : SIMIX_process_get_host(process);
+  return (process == nullptr) ? nullptr : SIMIX_process_get_host(process);
 }
 
 /* needs to be public and without simcall for exceptions and logging events */
 const char* SIMIX_host_self_get_name(void)
 {
   sg_host_t host = SIMIX_host_self();
-  if (host == NULL || SIMIX_process_self() == simix_global->maestro_process)
+  if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
     return "";
 
   return sg_host_get_name(host);
@@ -173,7 +173,7 @@ void SIMIX_host_add_auto_restart_process(
   arg->auto_restart = auto_restart;
 
   if( host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){
-    xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,NULL);
+    xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,nullptr);
     XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host));
   }
   xbt_dynar_push_as(sg_host_simix(host)->auto_restart_processes,smx_process_arg_t,arg);
@@ -193,16 +193,16 @@ void SIMIX_host_autorestart(sg_host_t host)
     if (simix_global->create_process_function) {
       simix_global->create_process_function(arg->name.c_str(),
                                             arg->code,
-                                            NULL,
+                                            nullptr,
                                             arg->hostname,
                                             arg->kill_time,
                                             arg->properties,
                                             arg->auto_restart,
-                                            NULL);
+                                            nullptr);
     } else {
       simcall_process_create(arg->name.c_str(),
                              arg->code,
-                             NULL,
+                             nullptr,
                              arg->hostname,
                              arg->kill_time,
                              arg->properties,
@@ -250,7 +250,7 @@ smx_synchro_t SIMIX_execution_parallel_start(const char *name,
     double *flops_amount, double *bytes_amount,
     double amount, double rate){
 
-  sg_host_t *host_list_cpy = NULL;
+  sg_host_t *host_list_cpy = nullptr;
   int i;
 
   /* alloc structures and initialize */
@@ -362,7 +362,7 @@ void SIMIX_execution_finish(simgrid::simix::Exec *exec)
     if (simcall->issuer->host->isOff())
       simcall->issuer->context->iwannadie = 1;
 
-    simcall->issuer->waiting_synchro = NULL;
+    simcall->issuer->waiting_synchro = nullptr;
     simcall_execution_wait__set__result(simcall, exec->state);
     SIMIX_simcall_answer(simcall);
   }
index c4a1033..c43a07f 100644 (file)
@@ -20,7 +20,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)
  * \brief Internal function to create a SIMIX storage.
  * \param name name of the storage to create
  * \param storage the SURF storage to encapsulate
- * \param data some user data (may be NULL)
+ * \param data some user data (may be nullptr)
  */
 smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data)
 {
@@ -42,7 +42,7 @@ void SIMIX_storage_destroy(void *s)
 {
   smx_storage_priv_t storage = (smx_storage_priv_t) s;
 
-  xbt_assert((storage != NULL), "Invalid parameters");
+  xbt_assert((storage != nullptr), "Invalid parameters");
   if (storage->data)
     free(storage->data);
 
@@ -289,7 +289,7 @@ void SIMIX_io_finish(smx_synchro_t synchro)
       simcall->issuer->context->iwannadie = 1;
     }
 
-    simcall->issuer->waiting_synchro = NULL;
+    simcall->issuer->waiting_synchro = nullptr;
     SIMIX_simcall_answer(simcall);
   }
 
index a0c83cb..072a961 100644 (file)
@@ -47,10 +47,10 @@ smx_mailbox_t SIMIX_mbox_create(const char *name)
     mbox->name = xbt_strdup(name);
     mbox->comm_queue = new std::deque<smx_synchro_t>();
     mbox->done_comm_queue = nullptr; // Allocated on need only
-    mbox->permanent_receiver=NULL;
+    mbox->permanent_receiver=nullptr;
 
     XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
-    xbt_dict_set(mailboxes, mbox->name, mbox, NULL);
+    xbt_dict_set(mailboxes, mbox->name, mbox, nullptr);
   }
   return mbox;
 }
@@ -105,7 +105,7 @@ void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t synchro)
 {
   simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
 
-  comm->mbox = NULL;
+  comm->mbox = nullptr;
   for (auto it = mbox->comm_queue->begin(); it != mbox->comm_queue->end(); it++)
     if (*it == comm) {
       mbox->comm_queue->erase(it);
@@ -117,12 +117,12 @@ void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t synchro)
 /**
  *  \brief Checks if there is a communication synchro queued in a deque matching our needs
  *  \param type The type of communication we are looking for (comm_send, comm_recv)
- *  \return The communication synchro if found, NULL otherwise
+ *  \return The communication synchro if found, nullptr otherwise
  */
 static smx_synchro_t _find_matching_comm(std::deque<smx_synchro_t> *deque, e_smx_comm_type_t type,
     int (*match_fun)(void *, void *,smx_synchro_t), void *this_user_data, smx_synchro_t my_synchro, bool remove_matching)
 {
-  void* other_user_data = NULL;
+  void* other_user_data = nullptr;
 
   for(auto it = deque->begin(); it != deque->end(); it++){
     smx_synchro_t synchro = *it;
@@ -143,7 +143,7 @@ static smx_synchro_t _find_matching_comm(std::deque<smx_synchro_t> *deque, e_smx
 #if HAVE_MC
       comm->mbox_cpy = comm->mbox;
 #endif
-      comm->mbox = NULL;
+      comm->mbox = nullptr;
       return comm;
     }
     XBT_DEBUG("Sorry, communication synchro %p does not match our needs:"
@@ -151,7 +151,7 @@ static smx_synchro_t _find_matching_comm(std::deque<smx_synchro_t> *deque, e_smx
               comm, (int)comm->type, (int)type);
   }
   XBT_DEBUG("No matching communication synchro found");
-  return NULL;
+  return nullptr;
 }
 
 /******************************************************************************/
@@ -164,7 +164,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t
                                   void (*copy_data_fun)(smx_synchro_t, void*, size_t),
           void *data, double timeout){
   smx_synchro_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate,
-                           src_buff, src_buff_size, match_fun, NULL, copy_data_fun,
+                           src_buff, src_buff_size, match_fun, nullptr, copy_data_fun,
                data, 0);
   SIMCALL_SET_MC_VALUE(simcall, 0);
   simcall_HANDLER_comm_wait(simcall, comm, timeout);
@@ -195,7 +195,7 @@ XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_
     other_synchro = this_synchro;
     other_comm = static_cast<simgrid::simix::Comm*>(other_synchro);
 
-    if (mbox->permanent_receiver!=NULL){
+    if (mbox->permanent_receiver!=nullptr){
       //this mailbox is for small messages, which have to be sent right now
       other_synchro->state = SIMIX_READY;
       other_comm->dst_proc=mbox->permanent_receiver;
@@ -222,7 +222,7 @@ XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_
     other_comm->detached = true;
     other_comm->clean_fun = clean_fun;
   } else {
-    other_comm->clean_fun = NULL;
+    other_comm->clean_fun = nullptr;
   }
 
   /* Setup the communication synchro */
@@ -239,11 +239,11 @@ XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_
 
   if (MC_is_active() || MC_record_replay_is_active()) {
     other_comm->state = SIMIX_RUNNING;
-    return (detached ? NULL : other_comm);
+    return (detached ? nullptr : other_comm);
   }
 
   SIMIX_comm_start(other_comm);
-  return (detached ? NULL : other_comm);
+  return (detached ? nullptr : other_comm);
 }
 
 XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox,
@@ -293,7 +293,7 @@ smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox, void
         XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",other_comm);
         other_comm->state = SIMIX_DONE;
         other_comm->type = SIMIX_COMM_DONE;
-        other_comm->mbox = NULL;
+        other_comm->mbox = nullptr;
       }
       other_comm->unref();
       static_cast<simgrid::simix::Comm*>(this_synchro)->unref();
@@ -363,7 +363,7 @@ smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t mbox, int
     this_comm = new simgrid::simix::Comm(SIMIX_COMM_RECEIVE);
     smx_type = SIMIX_COMM_SEND;
   } 
-  smx_synchro_t other_synchro=NULL;
+  smx_synchro_t other_synchro=nullptr;
   if(mbox->permanent_receiver && ! mbox->done_comm_queue->empty()){
     XBT_DEBUG("first check in the permanent recv mailbox, to see if we already got something");
     other_synchro =
@@ -639,8 +639,8 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
 
         XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d",
                   synchro,
-                  comm->src_proc ? sg_host_get_name(comm->src_proc->host) : NULL,
-                  comm->dst_proc ? sg_host_get_name(comm->dst_proc->host) : NULL,
+                  comm->src_proc ? sg_host_get_name(comm->src_proc->host) : nullptr,
+                  comm->dst_proc ? sg_host_get_name(comm->dst_proc->host) : nullptr,
                   simcall->issuer->name.c_str(), simcall->issuer, comm->detached);
         if (comm->src_proc == simcall->issuer) {
           XBT_DEBUG("I'm source");
@@ -678,7 +678,7 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
       simcall->issuer->context->iwannadie = 1;
     }
 
-    simcall->issuer->waiting_synchro = NULL;
+    simcall->issuer->waiting_synchro = nullptr;
     xbt_fifo_remove(simcall->issuer->comms, synchro);
     if(comm->detached){
       if(simcall->issuer == comm->src_proc){
@@ -726,7 +726,7 @@ void SIMIX_comm_copy_buffer_callback(smx_synchro_t synchro, void* buff, size_t b
   memcpy(comm->dst_buff, buff, buff_size);
   if (comm->detached) { // if this is a detached send, the source buffer was duplicated by SMPI sender to make the original buffer available to the application ASAP
     xbt_free(buff);
-    comm->src_buff = NULL;
+    comm->src_buff = nullptr;
   }
 }
 
index 0fce5df..a5f5496 100644 (file)
@@ -39,7 +39,7 @@ smx_process_t SIMIX_process_self(void)
 {
   smx_context_t self_context = SIMIX_context_self();
 
-  return self_context ? self_context->process() : NULL;
+  return self_context ? self_context->process() : nullptr;
 }
 
 /**
@@ -62,7 +62,7 @@ void SIMIX_process_cleanup(smx_process_t process)
   SIMIX_process_on_exit_runall(process);
 
   /* Unregister from the kill timer if any */
-  if (process->kill_timer != NULL)
+  if (process->kill_timer != nullptr)
       SIMIX_timer_remove(process->kill_timer);
 
   xbt_os_mutex_acquire(simix_global->mutex);
@@ -79,7 +79,7 @@ void SIMIX_process_cleanup(smx_process_t process)
     if (comm->src_proc == process) {
       XBT_DEBUG("Found an unfinished send comm %p (detached = %d), state %d, src = %p, dst = %p",
           comm, comm->detached, (int)comm->state, comm->src_proc, comm->dst_proc);
-      comm->src_proc = NULL;
+      comm->src_proc = nullptr;
 
       /* I'm not supposed to destroy a detached comm from the sender side, */
       if (comm->detached)
@@ -91,9 +91,9 @@ void SIMIX_process_cleanup(smx_process_t process)
     else if (comm->dst_proc == process){
       XBT_DEBUG("Found an unfinished recv comm %p, state %d, src = %p, dst = %p",
           comm, (int)comm->state, comm->src_proc, comm->dst_proc);
-      comm->dst_proc = NULL;
+      comm->dst_proc = nullptr;
 
-      if (comm->detached && comm->src_proc != NULL) {
+      if (comm->detached && comm->src_proc != nullptr) {
         /* the comm will be freed right now, remove it from the sender */
         xbt_fifo_remove(comm->src_proc->comms, comm);
       }
@@ -122,7 +122,7 @@ void SIMIX_process_cleanup(smx_process_t process)
  */
 void SIMIX_process_empty_trash(void)
 {
-  smx_process_t process = NULL;
+  smx_process_t process = nullptr;
 
   while ((process = (smx_process_t) xbt_swag_extract(simix_global->process_to_destroy))) {
     XBT_DEBUG("Getting rid of %p",process);
@@ -146,7 +146,7 @@ namespace simix {
 
 void create_maestro(std::function<void()> code)
 {
-  smx_process_t maestro = NULL;
+  smx_process_t maestro = nullptr;
   /* Create maestro process and intilialize it */
   maestro = new simgrid::simix::Process();
   maestro->pid = simix_process_maxpid++;
@@ -157,7 +157,7 @@ void create_maestro(std::function<void()> code)
   XBT_RUNNING_CTX_INITIALIZE(maestro->running_ctx);
 
   if (!code) {
-    maestro->context = SIMIX_context_new(std::function<void()>(), NULL, maestro);
+    maestro->context = SIMIX_context_new(std::function<void()>(), nullptr, maestro);
   } else {
     if (!simix_global)
       xbt_die("simix is not initialized, please call MSG_init first");
@@ -223,7 +223,7 @@ smx_process_t SIMIX_process_create(
                           int auto_restart,
                           smx_process_t parent_process)
 {
-  smx_process_t process = NULL;
+  smx_process_t process = nullptr;
   sg_host_t host = sg_host_by_name(hostname);
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
@@ -236,7 +236,7 @@ smx_process_t SIMIX_process_create(
   else {
     process = new simgrid::simix::Process();
 
-    xbt_assert(code && host != NULL, "Invalid parameters");
+    xbt_assert(code && host != nullptr, "Invalid parameters");
     /* Process data */
     process->pid = simix_process_maxpid++;
     process->name = simgrid::xbt::string(name);
@@ -247,7 +247,7 @@ smx_process_t SIMIX_process_create(
     /* Initiliaze data segment to default value */
     SIMIX_segment_index_set(process, -1);
 
-     if (parent_process != NULL) {
+     if (parent_process != nullptr) {
        process->ppid = SIMIX_process_get_PID(parent_process);
        /* SMPI process have their own data segment and
           each other inherit from their father */
@@ -338,7 +338,7 @@ smx_process_t SIMIX_process_attach(
   process->ppid = -1;
   /* Initiliaze data segment to default value */
   SIMIX_segment_index_set(process, -1);
-  if (parent_process != NULL) {
+  if (parent_process != nullptr) {
     process->ppid = SIMIX_process_get_PID(parent_process);
    /* SMPI process have their own data segment and
       each other inherit from their father */
@@ -495,7 +495,7 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
       break;
     } */
 
-    process->waiting_synchro = NULL;
+    process->waiting_synchro = nullptr;
   }
   if(!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != issuer) {
     XBT_DEBUG("Inserting %s in the to_run list", process->name.c_str());
@@ -549,7 +549,7 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con
       SIMIX_io_destroy(process->waiting_synchro);
     }
   }
-  process->waiting_synchro = NULL;
+  process->waiting_synchro = nullptr;
 
 }
 
@@ -562,7 +562,7 @@ void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) {
  */
 void SIMIX_process_killall(smx_process_t issuer, int reset_pid)
 {
-  smx_process_t p = NULL;
+  smx_process_t p = nullptr;
 
   while ((p = (smx_process_t) xbt_swag_extract(simix_global->process_list))) {
     if (p != issuer) {
@@ -585,7 +585,7 @@ void simcall_HANDLER_process_set_host(smx_simcall_t simcall, smx_process_t proce
 void SIMIX_process_change_host(smx_process_t process,
              sg_host_t dest)
 {
-  xbt_assert((process != NULL), "Invalid parameters");
+  xbt_assert((process != nullptr), "Invalid parameters");
   xbt_swag_remove(process, sg_host_simix(process->host)->process_list);
   process->host = dest;
   xbt_swag_insert(process, sg_host_simix(dest)->process_list);
@@ -610,7 +610,7 @@ smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
 {
   if (process->suspended) {
     XBT_DEBUG("Process '%s' is already suspended", process->name.c_str());
-    return NULL;
+    return nullptr;
   }
 
   process->suspended = 1;
@@ -622,7 +622,7 @@ smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
       process->waiting_synchro->suspend();
     /* If the other process is not waiting, its suspension is delayed to when the process is rescheduled. */
 
-    return NULL;
+    return nullptr;
   } else {
     /* FIXME: computation size is zero. Is it okay that bound is zero ? */
     return SIMIX_execution_start(process, "suspend", 0.0, 1.0, 0.0, 0);
@@ -667,14 +667,14 @@ int SIMIX_process_count(void)
 }
 
 int SIMIX_process_get_PID(smx_process_t self){
-  if (self == NULL)
+  if (self == nullptr)
     return 0;
   else
     return self->pid;
 }
 
 int SIMIX_process_get_PPID(smx_process_t self){
-  if (self == NULL)
+  if (self == nullptr)
     return 0;
   else
     return self->ppid;
@@ -685,7 +685,7 @@ void* SIMIX_process_self_get_data()
   smx_process_t self = SIMIX_process_self();
 
   if (!self) {
-    return NULL;
+    return nullptr;
   }
   return SIMIX_process_get_data(self);
 }
@@ -717,7 +717,7 @@ sg_host_t SIMIX_process_get_host(smx_process_t process)
 const char* SIMIX_process_self_get_name(void) {
 
   smx_process_t process = SIMIX_process_self();
-  if (process == NULL || process == simix_global->maestro_process)
+  if (process == nullptr || process == simix_global->maestro_process)
     return "maestro";
 
   return SIMIX_process_get_name(process);
@@ -735,7 +735,7 @@ smx_process_t SIMIX_process_get_by_name(const char* name)
     if (proc->name == name)
       return proc;
   }
-  return NULL;
+  return nullptr;
 }
 
 int SIMIX_process_is_suspended(smx_process_t process)
@@ -765,7 +765,7 @@ static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synch
       smx_simcall_t simcall = sleep->simcalls.front();
       sleep->simcalls.pop_front();
       simcall_process_sleep__set__result(simcall, SIMIX_DONE);
-      simcall->issuer->waiting_synchro = NULL;
+      simcall->issuer->waiting_synchro = nullptr;
       if (simcall->issuer->suspended) {
         XBT_DEBUG("Wait! This process is suspended and can't wake up now.");
         simcall->issuer->suspended = 0;
@@ -775,7 +775,7 @@ static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synch
       }
     }
     sleep->surf_sleep->unref();
-    sleep->surf_sleep = NULL;
+    sleep->surf_sleep = nullptr;
   }
   delete sleep;
   return 0;
@@ -825,7 +825,7 @@ void SIMIX_process_sleep_destroy(smx_synchro_t synchro)
 
   if (sleep->surf_sleep) {
     sleep->surf_sleep->unref();
-    sleep->surf_sleep = NULL;
+    sleep->surf_sleep = nullptr;
   }
 }
 
@@ -849,7 +849,7 @@ void SIMIX_process_yield(smx_process_t self)
 
   if (self->new_host) {
     SIMIX_process_change_host(self, self->new_host);
-    self->new_host = NULL;
+    self->new_host = nullptr;
   }
 
   if (self->context->iwannadie){
@@ -918,13 +918,13 @@ smx_process_t SIMIX_process_from_PID(int PID)
    if (proc->pid == (unsigned long) PID)
     return proc;
   }
-  return NULL;
+  return nullptr;
 }
 
 /** @brief returns a dynar containg all currently existing processes */
 xbt_dynar_t SIMIX_processes_as_dynar(void) {
   smx_process_t proc;
-  xbt_dynar_t res = xbt_dynar_new(sizeof(smx_process_t),NULL);
+  xbt_dynar_t res = xbt_dynar_new(sizeof(smx_process_t),nullptr);
   xbt_swag_foreach(proc, simix_global->process_list) {
     xbt_dynar_push(res,&proc);
   }
@@ -946,7 +946,7 @@ void SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void
   xbt_assert(process, "current process not found: are you in maestro context ?");
 
   if (!process->on_exit) {
-    process->on_exit = xbt_dynar_new(sizeof(s_smx_process_exit_fun_t), NULL);
+    process->on_exit = xbt_dynar_new(sizeof(s_smx_process_exit_fun_t), nullptr);
   }
 
   s_smx_process_exit_fun_t exit_fun = {fun, data};
@@ -979,7 +979,7 @@ smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer)
   arg.hostname = sg_host_get_name(process->host);
   arg.kill_time = SIMIX_timer_get_date(process->kill_timer);
   arg.data = process->data;
-  arg.properties = NULL;
+  arg.properties = nullptr;
   arg.auto_restart = process->auto_restart;
 
   //kill the old process
index b0eba6f..2797cb5 100644 (file)
@@ -86,7 +86,7 @@ void SIMIX_synchro_finish(smx_synchro_t synchro)
   }
 
   SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
-  simcall->issuer->waiting_synchro = NULL;
+  simcall->issuer->waiting_synchro = nullptr;
   delete synchro;
   SIMIX_simcall_answer(simcall);
   XBT_OUT();
@@ -122,7 +122,7 @@ void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
 {
   XBT_IN("(%p)",simcall);
   /* FIXME: check where to validate the arguments */
-  smx_synchro_t synchro = NULL;
+  smx_synchro_t synchro = nullptr;
   smx_process_t process = simcall->issuer;
 
   if (mutex->locked) {
@@ -192,13 +192,13 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer)
     /*process to wake up */
     smx_process_t p = (smx_process_t) xbt_swag_extract(mutex->sleeping);
     delete p->waiting_synchro;
-    p->waiting_synchro = NULL;
+    p->waiting_synchro = nullptr;
     mutex->owner = p;
     SIMIX_simcall_answer(&p->simcall);
   } else {
     /* nobody to wake up */
     mutex->locked = 0;
-    mutex->owner = NULL;
+    mutex->owner = nullptr;
   }
   XBT_OUT();
 }
@@ -234,7 +234,7 @@ smx_cond_t SIMIX_cond_init(void)
   simgrid::simix::Process p;
   smx_cond_t cond = xbt_new0(s_smx_cond_t, 1);
   cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
-  cond->mutex = NULL;
+  cond->mutex = nullptr;
   XBT_OUT();
   return cond;
 }
@@ -271,13 +271,13 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
                              smx_process_t issuer, smx_simcall_t simcall)
 {
   XBT_IN("(%p, %p, %f, %p,%p)",cond,mutex,timeout,issuer,simcall);
-  smx_synchro_t synchro = NULL;
+  smx_synchro_t synchro = nullptr;
 
   XBT_DEBUG("Wait condition %p", cond);
 
   /* If there is a mutex unlock it */
   /* FIXME: what happens if the issuer is not the owner of the mutex? */
-  if (mutex != NULL) {
+  if (mutex != nullptr) {
     cond->mutex = mutex;
     SIMIX_mutex_unlock(mutex, issuer);
   }
@@ -299,9 +299,9 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
 void SIMIX_cond_signal(smx_cond_t cond)
 {
   XBT_IN("(%p)",cond);
-  smx_process_t proc = NULL;
-  smx_mutex_t mutex = NULL;
-  smx_simcall_t simcall = NULL;
+  smx_process_t proc = nullptr;
+  smx_mutex_t mutex = nullptr;
+  smx_simcall_t simcall = nullptr;
 
   XBT_DEBUG("Signal condition %p", cond);
 
@@ -311,7 +311,7 @@ void SIMIX_cond_signal(smx_cond_t cond)
 
     /* Destroy waiter's synchronization */
     delete proc->waiting_synchro;
-    proc->waiting_synchro = NULL;
+    proc->waiting_synchro = nullptr;
 
     /* Now transform the cond wait simcall into a mutex lock one */
     simcall = &proc->simcall;
@@ -356,7 +356,7 @@ void SIMIX_cond_destroy(smx_cond_t cond)
   XBT_IN("(%p)",cond);
   XBT_DEBUG("Destroy condition %p", cond);
 
-  if (cond != NULL) {
+  if (cond != nullptr) {
     xbt_assert(xbt_swag_size(cond->sleeping) == 0,
                 "Cannot destroy conditional since someone is still using it");
 
@@ -386,7 +386,7 @@ void SIMIX_sem_destroy(smx_sem_t sem)
 {
   XBT_IN("(%p)",sem);
   XBT_DEBUG("Destroy semaphore %p", sem);
-  if (sem != NULL) {
+  if (sem != nullptr) {
     xbt_assert(xbt_swag_size(sem->sleeping) == 0,
                 "Cannot destroy semaphore since someone is still using it");
     xbt_swag_free(sem->sleeping);
@@ -411,7 +411,7 @@ void SIMIX_sem_release(smx_sem_t sem)
   XBT_DEBUG("Sem release semaphore %p", sem);
   if ((proc = (smx_process_t) xbt_swag_extract(sem->sleeping))) {
     delete proc->waiting_synchro;
-    proc->waiting_synchro = NULL;
+    proc->waiting_synchro = nullptr;
     SIMIX_simcall_answer(&proc->simcall);
   } else if (sem->value < SMX_SEM_NOLIMIT) {
     sem->value++;
@@ -442,7 +442,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer,
                             smx_simcall_t simcall)
 {
   XBT_IN("(%p, %f, %p, %p)",sem,timeout,issuer,simcall);
-  smx_synchro_t synchro = NULL;
+  smx_synchro_t synchro = nullptr;
 
   XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
   if (sem->value <= 0) {
index 7b417fc..f7b6c3e 100644 (file)
@@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_vm, simix, "Logging specific to SIMIX (vms
 /**
  * @brief Internal function to create a SIMIX host.
  * @param name name of the host to create
- * @param data some user data (may be NULL)
+ * @param data some user data (may be nullptr)
  */
 sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host)
 {
@@ -50,7 +50,7 @@ static int __can_be_started(sg_host_t vm)
 
   int pm_overcommit = 0;
   long pm_ramsize = host_get_ramsize(pm, &pm_overcommit);
-  long vm_ramsize = host_get_ramsize(vm, NULL);
+  long vm_ramsize = host_get_ramsize(vm, nullptr);
 
   if (!pm_ramsize) {
     /* We assume users do not want to care about ramsize. */
@@ -68,7 +68,7 @@ static int __can_be_started(sg_host_t vm)
     unsigned int cursor = 0;
     sg_host_t another_vm;
     xbt_dynar_foreach(dyn_vms, cursor, another_vm) {
-      long another_vm_ramsize = host_get_ramsize(vm, NULL);
+      long another_vm_ramsize = host_get_ramsize(vm, nullptr);
       total_ramsize_of_vms += another_vm_ramsize;
     }
   }