]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix compilation warning in storage manager to get rid of 'initialzer lists' warning
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Fri, 6 Aug 2021 16:35:46 +0000 (18:35 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:03 +0000 (09:03 +0100)
Description:
when using:
mutex = PTHREAD_MUTEX_INITIALIZER;
instead of:
pthread_mutex_init(&mutex, NULL);
There could be warning on some environments:
store_mngr.c:31:10: warning: extended initializer lists only available
with -std=c++11 or -std=gnu++11 [enabled by default]
    mutex = PTHREAD_MUTEX_INITIALIZER;

To get rid of it, simply use the init/destroy mutex helpers.

bacula/src/dird/store_mngr.c

index 3e6b8afa8cac682907894460867bd97b34b3cbc4..45383fc72c8f1ec867610142b01a981c72ca22e9 100644 (file)
@@ -30,7 +30,7 @@ storage::storage() {
    list_str = get_pool_memory(PM_MESSAGE);
    *source = 0;
    store = NULL;
-   mutex = PTHREAD_MUTEX_INITIALIZER;
+   pthread_mutex_init(&mutex, NULL);
 }
 
 storage::~storage() {
@@ -49,6 +49,8 @@ storage::~storage() {
    if (list_str) {
       free_and_null_pool_memory(list_str);
    }
+
+   pthread_mutex_destroy(&mutex);
 }
 
 void storage::set_rw(bool write) {