From 256b562770fb3e63b48354a0cefba69478aabe4f Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 20 Dec 2008 03:55:09 +0100 Subject: [PATCH] Make xbps_add_array_to_dict accept any object, not just arrays. Thus it's now named xbps_add_obj_to_dict(). --HG-- extra : convert_revision : 81a53b615cd7578a2c99f40f9b8550e2ee7fa426 --- utils/plist.c | 10 +++++----- utils/plist.h | 8 ++++---- utils/xbps-pkgdb.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/utils/plist.c b/utils/plist.c index 12d55caa02..bac0983498 100644 --- a/utils/plist.c +++ b/utils/plist.c @@ -36,16 +36,16 @@ static void xbps_list_strings_in_array2(prop_object_t); bool -xbps_add_array_to_dict(prop_dictionary_t dict, prop_array_t array, +xbps_add_obj_to_dict(prop_dictionary_t dict, prop_object_t obj, const char *key) { - if (dict == NULL || array == NULL || key == NULL) + if (dict == NULL || obj == NULL || key == NULL) return false; - if (!prop_dictionary_set(dict, key, array)) + if (!prop_dictionary_set(dict, key, obj)) return false; - prop_object_release(array); + prop_object_release(obj); return true; } @@ -178,7 +178,7 @@ xbps_register_repository(const char *uri) goto fail; /* Add the array obj into the main dictionary. */ - if (!xbps_add_array_to_dict(dict, array, "repository-list")) + if (!xbps_add_obj_to_dict(dict, array, "repository-list")) goto fail; /* Write dictionary into plist file. */ diff --git a/utils/plist.h b/utils/plist.h index 8dc24b6033..310ba829fa 100644 --- a/utils/plist.h +++ b/utils/plist.h @@ -27,17 +27,17 @@ #define _XBPS_PLIST_UTILS_H_ /* - * Adds an array object with specified key into a dictionary. + * Adds an opaque object with specified key into a dictionary. * * Arguments: * - prop_dictionary_t: dictionary to store the array. - * - prop_array_t: the array to be stored. - * - const char *: the key associated with the array. + * - prop_object_t: the object to be stored. + * - const char *: the key associated with the object. * * Returns true on success, false on failure. */ bool -xbps_add_array_to_dict(prop_dictionary_t, prop_array_t, const char *); +xbps_add_obj_to_dict(prop_dictionary_t, prop_object_t, const char *); /* * Adds an opaque object into an array. diff --git a/utils/xbps-pkgdb.c b/utils/xbps-pkgdb.c index e1eedb50c5..cdc51e95ab 100644 --- a/utils/xbps-pkgdb.c +++ b/utils/xbps-pkgdb.c @@ -137,7 +137,7 @@ unregister_pkg(prop_dictionary_t dict, const char *pkgname, const char *dbfile) } prop_array_remove(array, i); - if (!xbps_add_array_to_dict(dict, array, "packages")) { + if (!xbps_add_obj_to_dict(dict, array, "packages")) { printf("=> ERROR: couldn't unregister %s from database\n", pkgname); exit(1); @@ -242,7 +242,7 @@ main(int argc, char **argv) /* Add array into main dictionary. */ dbdict = prop_dictionary_create(); - if (!xbps_add_array_to_dict(dbdict, dbarray, + if (!xbps_add_obj_to_dict(dbdict, dbarray, "packages_installed")) { printf("=> ERROR: couldn't register pkg\n"); exit(1);