Introduce xbps_array_add_first() to insert obj at the head of array.
The behaviour of this routine mimics the existing xbps_array_add() with the difference that stored objects are moved to the right to insert our object as the first element on the array. Use this to add replaced packages in the transaction array at the head rather than at the end, to preserve the proper sorting order.
This commit is contained in:
@@ -123,7 +123,8 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs)
|
||||
*/
|
||||
xbps_dictionary_set_cstring_nocopy(instd,
|
||||
"transaction", "remove");
|
||||
xbps_array_add(pkgs, instd);
|
||||
if (!xbps_array_add_first(pkgs, instd))
|
||||
return EINVAL;
|
||||
free(curpkgname);
|
||||
}
|
||||
xbps_object_iterator_release(iter);
|
||||
|
||||
Reference in New Issue
Block a user