From c2e72d466071a413f22ab4d6cab990a60528e57c Mon Sep 17 00:00:00 2001 From: Andreas Eknes Lie Date: Tue, 19 Sep 2023 15:38:26 +0200 Subject: [PATCH] Initialize struct members --- src/clib/lib/job_queue/job_list.cpp | 2 +- src/clib/lib/job_queue/job_queue.cpp | 6 +++--- src/clib/lib/job_queue/job_queue_status.cpp | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/clib/lib/job_queue/job_list.cpp b/src/clib/lib/job_queue/job_list.cpp index f3fc4a84d22..3c5bf96f18a 100644 --- a/src/clib/lib/job_queue/job_list.cpp +++ b/src/clib/lib/job_queue/job_list.cpp @@ -5,7 +5,7 @@ #include struct job_list_struct { - std::vector vec_jobs; + std::vector vec_jobs{}; pthread_rwlock_t lock{}; }; diff --git a/src/clib/lib/job_queue/job_queue.cpp b/src/clib/lib/job_queue/job_queue.cpp index b1957f1e0c7..2ce5d6a2148 100644 --- a/src/clib/lib/job_queue/job_queue.cpp +++ b/src/clib/lib/job_queue/job_queue.cpp @@ -4,10 +4,10 @@ #include struct job_queue_struct { - job_list_type *job_list; - job_queue_status_type *status; + job_list_type *job_list = nullptr; + job_queue_status_type *status = nullptr; /** A pointer to a driver instance (LSF|LOCAL) which actually 'does it'. */ - queue_driver_type *driver; + queue_driver_type *driver = nullptr; }; /** diff --git a/src/clib/lib/job_queue/job_queue_status.cpp b/src/clib/lib/job_queue/job_queue_status.cpp index 302133d9051..12cf6066725 100644 --- a/src/clib/lib/job_queue/job_queue_status.cpp +++ b/src/clib/lib/job_queue/job_queue_status.cpp @@ -4,9 +4,7 @@ #include job_queue_status_type *job_queue_status_alloc() { - auto status = new job_queue_status_struct; - pthread_rwlock_init(&status->rw_lock, nullptr); - return status; + return new job_queue_status_struct; } void job_queue_status_free(job_queue_status_type *status) { delete status; }