Revert "xbps_array_foreach_cb_multi: fix incorrect array counter."

This reverts commit 08aa44602f.

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.
This commit is contained in:
Duncaen 2019-06-22 23:30:45 +02:00 committed by Juan RP
parent a4dd0221ac
commit 66f66ab7a1

View File

@ -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);