From 66f66ab7a1499893c617b6e4e7a3a16179d15e0a Mon Sep 17 00:00:00 2001 From: Duncaen Date: Sat, 22 Jun 2019 23:30:45 +0200 Subject: [PATCH] Revert "xbps_array_foreach_cb_multi: fix incorrect array counter." This reverts commit 08aa44602fbe20893663b127670539a0de5a79ef. The element still has to be processed and ignored by one of the threads, it is not the last entry this will make the actually last item be ignored. --- lib/plist.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index 5c8e71a2..b26e2893 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -111,12 +111,10 @@ xbps_array_foreach_cb_multi(struct xbps_handle *xhp, if (xbps_object_type(array) != XBPS_TYPE_ARRAY) return 0; - if (!xbps_array_count(array)) + arraycount = xbps_array_count(array); + if (arraycount == 0) return 0; - /* - 1 because there's a private dict used internally */ - arraycount = xbps_array_count(array) - 1; - maxthreads = (int)sysconf(_SC_NPROCESSORS_ONLN); if (maxthreads <= 1 || arraycount <= 1) /* use single threaded routine */ return xbps_array_foreach_cb(xhp, array, dict, fn, arg);