Remove three unused API functions.

This commit is contained in:
Juan RP 2013-07-27 06:12:59 +02:00
parent 84d0e429ab
commit 432067de48
4 changed files with 7 additions and 138 deletions

6
NEWS
View File

@ -1,5 +1,11 @@
xbps-0.26 (???):
* libxbps: removed the following unused API functions:
- xbps_pkgdb_foreach_reverse_cb()
- xbps_callback_array_iter_reverse()
- xbps_callback_array_iter_reverse_in_dict()
* xbps-query(8): make -L list all repositories in the configuration file, even
the non working ones and print -1 in them. Closes issue #11 from github.

View File

@ -46,7 +46,7 @@
*
* This header documents the full API for the XBPS Library.
*/
#define XBPS_API_VERSION "20130620"
#define XBPS_API_VERSION "20130727"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@ -712,22 +712,6 @@ int xbps_pkgdb_foreach_cb(struct xbps_handle *xhp,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg);
/**
* Executes a function callback per a package dictionary registered
* in master package database (pkgdb) plist, in reverse order (upwards).
*
* @param[in] xhp The pointer to the xbps_handle struct.
* @param[in] fn Function callback to run for any pkg dictionary.
* @param[in] arg Argument to be passed to the function callback.
*
* @return 0 on success (all objects were processed), otherwise
* the value returned by the funcion callback.
*/
int xbps_pkgdb_foreach_reverse_cb(
struct xbps_handle *xhp,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg);
/**
* Returns a package dictionary from master package database (pkgdb) plist,
* matching pkgname or pkgver object in \a pkg.
@ -848,25 +832,6 @@ int xbps_callback_array_iter(struct xbps_handle *xhp,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg);
/**
* Executes a function callback specified in \a fn with \a arg passed
* as its argument into they array \a array in reverse order (upwards).
*
* @param[in] xhp The pointer to the xbps_handle struct.
* @param[in] array Proplib array to iterate.
* @param[in] fn Function callback to run on every object in the array.
* While running the function callback, the hird parameter (a pointer to
* a boolean) can be set to true to stop immediately the loop.
* @param[in] arg Argument to be passed to the function callback.
*
* @return 0 on success, otherwise the value returned by the function
* callback.
*/
int xbps_callback_array_iter_reverse(struct xbps_handle *xhp,
xbps_array_t array,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg);
/**
* Executes a function callback into the array associated with key \a key,
* contained in a proplib dictionary.
@ -889,28 +854,6 @@ int xbps_callback_array_iter_in_dict(struct xbps_handle *xhp,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg);
/**
* Executes a function callback (in reverse order) into the array
* associated with key \a key, contained in a proplib dictionary.
*
* @param[in] xhp The pointer to the xbps_handle struct.
* @param[in] dict Proplib dictionary where the array resides.
* @param[in] key Key associated with array.
* @param[in] fn Function callback to run on every
* object in the array. While running the function callback, the third
* parameter (a pointer to a boolean) can be set to true to stop
* immediately the loop.
* @param[in] arg Argument to be passed to the function callback.
*
* @return 0 on success (all objects were processed), otherwise
* the value returned by the function callback.
*/
int xbps_callback_array_iter_reverse_in_dict(struct xbps_handle *xhp,
xbps_dictionary_t dict,
const char *key,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg);
/**
* Match a virtual package name or pattern by looking at package's
* dictionary "provides" array object.

View File

@ -135,33 +135,6 @@ xbps_pkgdb_release(struct xbps_handle *xhp)
xbps_dbg_printf(xhp, "[pkgdb] released ok.\n");
}
int
xbps_pkgdb_foreach_reverse_cb(struct xbps_handle *xhp,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg)
{
xbps_array_t allkeys;
xbps_object_t obj;
xbps_dictionary_t pkgd;
unsigned int i;
int rv;
bool done = false;
if ((rv = xbps_pkgdb_init(xhp)) != 0)
return rv;
allkeys = xbps_dictionary_all_keys(xhp->pkgdb);
for (i = xbps_array_count(allkeys); i > 0; i--) {
obj = xbps_array_get(allkeys, i);
pkgd = xbps_dictionary_get_keysym(xhp->pkgdb, obj);
rv = (*fn)(xhp, pkgd, arg, &done);
if (rv != 0 || done)
break;
}
xbps_object_release(allkeys);
return rv;
}
int
xbps_pkgdb_foreach_cb(struct xbps_handle *xhp,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),

View File

@ -132,59 +132,6 @@ xbps_callback_array_iter_in_dict(struct xbps_handle *xhp,
return rv;
}
int
xbps_callback_array_iter_reverse(struct xbps_handle *xhp,
xbps_array_t array,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg)
{
xbps_object_t obj;
unsigned int cnt;
int rv = 0;
bool loop_done = false;
assert(xbps_object_type(array) == XBPS_TYPE_ARRAY);
assert(fn != NULL);
assert(xhp != NULL);
if ((cnt = xbps_array_count(array)) == 0)
return 0;
while (cnt--) {
obj = xbps_array_get(array, cnt);
if (obj == NULL)
continue;
rv = (*fn)(xhp, obj, arg, &loop_done);
if (rv != 0 || loop_done)
break;
}
return rv;
}
int
xbps_callback_array_iter_reverse_in_dict(struct xbps_handle *xhp,
xbps_dictionary_t dict,
const char *key,
int (*fn)(struct xbps_handle *, xbps_object_t, void *, bool *),
void *arg)
{
xbps_array_t array;
assert(xbps_object_type(dict) == XBPS_TYPE_DICTIONARY);
assert(key != NULL);
assert(fn != NULL);
assert(xhp != NULL);
array = xbps_dictionary_get(dict, key);
if (xbps_object_type(array) != XBPS_TYPE_ARRAY) {
xbps_dbg_printf(xhp, "invalid key '%s' for dictionary", key);
return EINVAL;
}
return xbps_callback_array_iter_reverse(xhp, array, fn, arg);
}
xbps_object_iterator_t
xbps_array_iter_from_dict(xbps_dictionary_t dict, const char *key)
{