From 83f25b8c498e912edd74a1720a824486f450f46c Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Fri, 4 Apr 2014 11:09:49 +0200 Subject: [PATCH] Add initializer for struct resourceParams to avoid uninitialized values --- src/Launcher/Launcher_Job.cxx | 8 -------- src/ResourcesManager/ResourcesManager.cxx | 12 ++++++++++++ src/ResourcesManager/ResourcesManager.hxx | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Launcher/Launcher_Job.cxx b/src/Launcher/Launcher_Job.cxx index fbc71d554..7874bfd90 100644 --- a/src/Launcher/Launcher_Job.cxx +++ b/src/Launcher/Launcher_Job.cxx @@ -44,14 +44,6 @@ Launcher::Job::Job() _result_directory = ""; _maximum_duration = ""; _maximum_duration_in_second = -1; - _resource_required_params.name = ""; - _resource_required_params.hostname = ""; - _resource_required_params.OS = ""; - _resource_required_params.nb_proc = -1; - _resource_required_params.nb_node = -1; - _resource_required_params.nb_proc_per_node = -1; - _resource_required_params.cpu_clock = -1; - _resource_required_params.mem_mb = -1; _queue = ""; _job_type = ""; _exclusive = false; diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index d22dc7c5b..1aed4d065 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -50,6 +50,18 @@ const string ResourcesManager_cpp::DEFAULT_RESOURCE_NAME = "localhost"; static LoadRateManagerFirst first; static LoadRateManagerCycl cycl; static LoadRateManagerAltCycl altcycl; + +resourceParams::resourceParams() +: can_launch_batch_jobs(false), + can_run_containers(false), + nb_proc(-1), + nb_node(-1), + nb_proc_per_node(-1), + cpu_clock(-1), + mem_mb(-1) +{ +} + //============================================================================= /*! * just for test diff --git a/src/ResourcesManager/ResourcesManager.hxx b/src/ResourcesManager/ResourcesManager.hxx index 50a651786..500f957c2 100644 --- a/src/ResourcesManager/ResourcesManager.hxx +++ b/src/ResourcesManager/ResourcesManager.hxx @@ -50,6 +50,8 @@ // session. struct resourceParams { + resourceParams(); + std::string name; std::string hostname; bool can_launch_batch_jobs; -- 2.39.2