diff --git a/src/clib/lib/include/ert/job_queue/job_list.hpp b/src/clib/lib/include/ert/job_queue/job_list.hpp index 0987de53f20..c4e6c4a62c3 100644 --- a/src/clib/lib/include/ert/job_queue/job_list.hpp +++ b/src/clib/lib/include/ert/job_queue/job_list.hpp @@ -8,9 +8,8 @@ typedef struct job_list_struct job_list_type; job_list_type *job_list_alloc(); void job_list_free(job_list_type *job_list); -int job_list_get_size(const job_list_type *job_list); void job_list_add_job(job_list_type *job_list, job_queue_node_type *job_node); -void job_list_reset(job_list_type *job_list); +size_t job_list_get_size(const job_list_type *job_list); void job_list_get_wrlock(job_list_type *list); void job_list_get_rdlock(job_list_type *list); void job_list_unlock(job_list_type *list); diff --git a/src/clib/lib/job_queue/job_list.cpp b/src/clib/lib/job_queue/job_list.cpp index 42dd749c372..3f506052d1c 100644 --- a/src/clib/lib/job_queue/job_list.cpp +++ b/src/clib/lib/job_queue/job_list.cpp @@ -11,24 +11,20 @@ struct job_list_struct { job_list_type *job_list_alloc() { return new job_list_type; } -void job_list_reset(job_list_type *job_list) { - for (auto &vec_job : job_list->vec_jobs) - job_queue_node_free(vec_job); - job_list->vec_jobs.clear(); -} - -int job_list_get_size(const job_list_type *job_list) { - return job_list->vec_jobs.size(); -} - void job_list_add_job(job_list_type *job_list, job_queue_node_type *job_node) { unsigned long queue_index = job_list->vec_jobs.size(); job_queue_node_set_queue_index(job_node, static_cast(queue_index)); job_list->vec_jobs.push_back(job_node); } +size_t job_list_get_size(const job_list_type *job_list) { + return job_list->vec_jobs.size(); +} + void job_list_free(job_list_type *job_list) { - job_list_reset(job_list); + for (auto &vec_job : job_list->vec_jobs) + job_queue_node_free(vec_job); + job_list->vec_jobs.clear(); delete job_list; } diff --git a/src/clib/old_tests/job_queue/test_job_list.cpp b/src/clib/old_tests/job_queue/test_job_list.cpp index 0dc830b0665..9f0bcb378ce 100644 --- a/src/clib/old_tests/job_queue/test_job_list.cpp +++ b/src/clib/old_tests/job_queue/test_job_list.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -18,9 +15,6 @@ void test_add_job() { job_list_add_job(list, node); test_assert_int_equal(job_list_get_size(list), 1); test_assert_int_equal(job_queue_node_get_queue_index(node), 0); - - job_list_reset(list); - test_assert_int_equal(0, job_list_get_size(list)); job_list_free(list); }