From 3eed9bca59dbc57cb4bc929795f0aa6a73bd1051 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 10 Feb 2020 09:14:50 +0100 Subject: [PATCH] xbps_array_foreach_cb_multi: use PTHREAD_MUTEX_INITIALIZER. We use defaults, no need to use pthread_mutex_init(). --- lib/plist.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index aa230897..19c2e0c2 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -104,7 +104,7 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp, unsigned int arraycount, slicecount; int rv = 0, error = 0, i, maxthreads; unsigned int reserved; - pthread_mutex_t reserved_lock; + pthread_mutex_t reserved_lock = PTHREAD_MUTEX_INITIALIZER; assert(fn != NULL); @@ -119,9 +119,6 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp, if (maxthreads <= 1 || arraycount <= 1) /* use single threaded routine */ return xbps_array_foreach_cb(xhp, array, dict, fn, arg); - if (pthread_mutex_init(&reserved_lock, PTHREAD_PROCESS_PRIVATE) != 0) - return 0; - thd = calloc(maxthreads, sizeof(*thd)); assert(thd);