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:
Juan RP
2014-11-13 15:18:21 +01:00
parent 74c30556fc
commit 43c9497feb
6 changed files with 70 additions and 2 deletions

View File

@ -59,6 +59,7 @@ xbps_object_iterator_t xbps_array_iterator(xbps_array_t);
xbps_object_t xbps_array_get(xbps_array_t, unsigned int);
bool xbps_array_set(xbps_array_t, unsigned int, xbps_object_t);
bool xbps_array_add(xbps_array_t, xbps_object_t);
bool xbps_array_add_first(xbps_array_t, xbps_object_t);
void xbps_array_remove(xbps_array_t, unsigned int);
bool xbps_array_equals(xbps_array_t, xbps_array_t);