From 6a66ef7c8b80c9f76525b67c64d847e3803ee517 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Mon, 30 May 2016 14:45:56 +0200 Subject: [PATCH 1/1] [s4u] Add member initializers --- src/simix/Synchro.h | 6 +++--- src/simix/SynchroComm.hpp | 22 +++++++++++----------- src/simix/SynchroExec.hpp | 4 ++-- src/simix/SynchroIo.hpp | 4 ++-- src/simix/SynchroRaw.hpp | 2 +- src/simix/SynchroSleep.hpp | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/simix/Synchro.h b/src/simix/Synchro.h index 1d7e83e2d0..da0e8e0837 100644 --- a/src/simix/Synchro.h +++ b/src/simix/Synchro.h @@ -22,9 +22,9 @@ namespace simix { public: Synchro(); virtual ~Synchro(); - e_smx_state_t state; /* State of the synchro */ + e_smx_state_t state = SIMIX_WAITING; /* State of the synchro */ std::string name; /* synchro name if any */ - xbt_fifo_t simcalls; /* List of simcalls waiting for this synchro */ + xbt_fifo_t simcalls = nullptr; /* List of simcalls waiting for this synchro */ char *category = nullptr; /* For instrumentation */ virtual void suspend()=0; @@ -34,7 +34,7 @@ namespace simix { void ref(); void unref(); private: - int refcount=1; + int refcount = 1; }; }} // namespace simgrid::simix #else /* not C++ */ diff --git a/src/simix/SynchroComm.hpp b/src/simix/SynchroComm.hpp index cd02960bbc..eca91c9828 100644 --- a/src/simix/SynchroComm.hpp +++ b/src/simix/SynchroComm.hpp @@ -34,17 +34,17 @@ namespace simix { smx_mailbox_t mbox = nullptr; /* Rendez-vous where the comm is queued */ #if HAVE_MC - smx_mailbox_t mbox_cpy; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR + smx_mailbox_t mbox_cpy = nullptr; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR (comm.mbox set to NULL when the communication is removed from the mailbox (used as garbage collector)) */ #endif bool detached = false; /* If detached or not */ - void (*clean_fun)(void*); /* Function to clean the detached src_buf if something goes wrong */ - int (*match_fun)(void*,void*,smx_synchro_t); /* Filter function used by the other side. It is used when + void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */ + int (*match_fun)(void*,void*,smx_synchro_t) = nullptr; /* Filter function used by the other side. It is used when looking if a given communication matches my needs. For that, myself must match the expectations of the other side, too. See */ - void (*copy_data_fun) (smx_synchro_t, void*, size_t); + void (*copy_data_fun) (smx_synchro_t, void*, size_t) =nullptr; /* Surf action data */ surf_action_t surf_comm = nullptr; /* The Surf communication action encapsulated */ @@ -52,18 +52,18 @@ namespace simix { surf_action_t dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */ smx_process_t src_proc = nullptr; smx_process_t dst_proc = nullptr; - double rate; - double task_size; + double rate = 0.0; + double task_size = 0.0; /* Data to be transfered */ void *src_buff = nullptr; void *dst_buff = nullptr; - size_t src_buff_size; - size_t *dst_buff_size; - bool copied = false; /* whether the data were already copied */ + size_t src_buff_size = 0; + size_t *dst_buff_size = nullptr; + bool copied = false; /* whether the data were already copied */ - void* src_data; /* User data associated to communication */ - void* dst_data; + void* src_data = nullptr; /* User data associated to communication */ + void* dst_data = nullptr; }; }} // namespace simgrid::simix diff --git a/src/simix/SynchroExec.hpp b/src/simix/SynchroExec.hpp index b771a39123..e52d59d227 100644 --- a/src/simix/SynchroExec.hpp +++ b/src/simix/SynchroExec.hpp @@ -21,8 +21,8 @@ namespace simix { void post() override; double remains(); - sg_host_t host; /* The host where the execution takes place. If NULL, then this is a parallel exec (and only surf knows the hosts) */ - surf_action_t surf_exec=nullptr;/* The Surf execution action encapsulated */ + sg_host_t host = nullptr; /* The host where the execution takes place. If NULL, then this is a parallel exec (and only surf knows the hosts) */ + surf_action_t surf_exec = nullptr; /* The Surf execution action encapsulated */ }; }} // namespace simgrid::simix diff --git a/src/simix/SynchroIo.hpp b/src/simix/SynchroIo.hpp index 53dcbdf043..0927c0b119 100644 --- a/src/simix/SynchroIo.hpp +++ b/src/simix/SynchroIo.hpp @@ -18,8 +18,8 @@ namespace simix { void resume() override; void post() override; - sg_host_t host; - surf_action_t surf_io; + sg_host_t host = nullptr; + surf_action_t surf_io = nullptr; }; }} // namespace simgrid::simix diff --git a/src/simix/SynchroRaw.hpp b/src/simix/SynchroRaw.hpp index 2b62f875f5..1d9345b8c5 100644 --- a/src/simix/SynchroRaw.hpp +++ b/src/simix/SynchroRaw.hpp @@ -20,7 +20,7 @@ namespace simix { void resume() override; void post() override; - surf_action_t sleep; + surf_action_t sleep = nullptr; }; }} // namespace simgrid::simix diff --git a/src/simix/SynchroSleep.hpp b/src/simix/SynchroSleep.hpp index 9f024cac0c..46a25aa32b 100644 --- a/src/simix/SynchroSleep.hpp +++ b/src/simix/SynchroSleep.hpp @@ -18,8 +18,8 @@ namespace simix { void resume() override; void post() override; - sg_host_t host; /* The host that is sleeping */ - surf_action_t surf_sleep; /* The Surf sleeping action encapsulated */ + sg_host_t host = nullptr; /* The host that is sleeping */ + surf_action_t surf_sleep = nullptr; /* The Surf sleeping action encapsulated */ }; }} // namespace simgrid::simix -- 2.20.1