From 00db5795b9e8a06e2aac8d8ec9ea2784ab63542f Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 15 Dec 2015 22:39:39 +0100 Subject: [PATCH] initialize fields at declaration, not everywhere in code --- src/surf/cpu_interface.cpp | 7 ++----- src/surf/cpu_interface.hpp | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 2b7c2e321e..a8d80c7106 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -132,7 +132,8 @@ void CpuModel::updateActionsStateFull(double now, double delta) /************ * Resource * ************/ -Cpu::Cpu(){ +Cpu::Cpu() +{ } @@ -143,8 +144,6 @@ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, , m_core(core) , m_speedPeak(speedPeak) , m_speedScale(speedScale) - , p_constraintCore(NULL) - , p_constraintCoreId(NULL) { } @@ -161,8 +160,6 @@ Cpu::Cpu(Model *model, const char *name, xbt_dict_t props, if (core > 1) xbt_assert(model == surf_cpu_model_pm); - p_constraintCore = NULL; - p_constraintCoreId = NULL; if (model->getUpdateMechanism() != UM_UNDEFINED) { p_constraintCore = xbt_new(lmm_constraint_t, core); p_constraintCoreId = xbt_new(void*, core); diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 590b798519..c74e737bbc 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -182,8 +182,8 @@ public: double m_speedScale; /*< Percentage of CPU available according to the trace, in [O,1] */ /* Note (hypervisor): */ - lmm_constraint_t *p_constraintCore; - void **p_constraintCoreId; + lmm_constraint_t *p_constraintCore=NULL; + void **p_constraintCoreId=NULL; }; /********** -- 2.20.1