Use xbps_callback_array_iter_in_repolist() and removed dup code.
--HG-- extra : convert_revision : 7eb9c1b3df3fc7fde2ff61ac0cce1d635c3fef18
This commit is contained in:
parent
90fd3828e6
commit
83ed100fcf
4 changed files with 16 additions and 57 deletions
10
lib/plist.c
10
lib/plist.c
|
@ -66,16 +66,19 @@ xbps_add_obj_to_array(prop_array_t array, prop_object_t obj)
|
|||
}
|
||||
|
||||
int
|
||||
xbps_callback_array_iter_in_repolist(const char *plist,
|
||||
int (*fn)(prop_object_t, void *, bool *),
|
||||
xbps_callback_array_iter_in_repolist(int (*fn)(prop_object_t, void *, bool *),
|
||||
void *arg)
|
||||
{
|
||||
prop_dictionary_t repolistd;
|
||||
char *plist;
|
||||
int rv = 0;
|
||||
|
||||
assert(plist != NULL);
|
||||
assert(fn != NULL);
|
||||
|
||||
plist = xbps_append_full_path(true, NULL, XBPS_REPOLIST);
|
||||
if (plist == NULL)
|
||||
return EINVAL;
|
||||
|
||||
/*
|
||||
* Get the dictionary with the list of registered repositories.
|
||||
*/
|
||||
|
@ -91,6 +94,7 @@ xbps_callback_array_iter_in_repolist(const char *plist,
|
|||
rv = xbps_callback_array_iter_in_dict(repolistd, "repository-list",
|
||||
fn, arg);
|
||||
prop_object_release(repolistd);
|
||||
free(plist);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue