From 9efba6749f534b8b4d3fd3f157e5080e5a94a982 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Sat, 24 Dec 2022 13:58:36 +0100 Subject: [PATCH] lib: remove xhp argument from xbps_plist_{array,dictionary}_from_file --- bin/xbps-dgraph/main.c | 2 +- bin/xbps-pkgdb/check.c | 2 +- include/xbps.h.in | 14 ++++++-------- lib/pkgdb.c | 2 +- lib/proplib_wrapper.c | 12 ++++++------ lib/repo.c | 2 +- lib/verifysig.c | 2 +- 7 files changed, 17 insertions(+), 19 deletions(-) diff --git a/bin/xbps-dgraph/main.c b/bin/xbps-dgraph/main.c index ceb0723d..5f6eee08 100644 --- a/bin/xbps-dgraph/main.c +++ b/bin/xbps-dgraph/main.c @@ -612,7 +612,7 @@ main(int argc, char **argv) if (conf_file == NULL) conf_file = _DGRAPH_CFFILE; - confd = xbps_plist_dictionary_from_file(&xh, conf_file); + confd = xbps_plist_dictionary_from_file(conf_file); if (confd == NULL) { if (errno != ENOENT) die("cannot read conf file `%s'", conf_file); diff --git a/bin/xbps-pkgdb/check.c b/bin/xbps-pkgdb/check.c index 061d521c..7e835290 100644 --- a/bin/xbps-pkgdb/check.c +++ b/bin/xbps-pkgdb/check.c @@ -95,7 +95,7 @@ check_pkg_integrity(struct xbps_handle *xhp, buf = xbps_xasprintf("%s/.%s-files.plist", xhp->metadir, pkgname); assert(buf); - filesd = xbps_plist_dictionary_from_file(xhp, buf); + filesd = xbps_plist_dictionary_from_file(buf); if (filesd == NULL) { fprintf(stderr, "%s: cannot read %s, ignoring...\n", pkgname, buf); diff --git a/include/xbps.h.in b/include/xbps.h.in index 2c2044d2..5d065013 100644 --- a/include/xbps.h.in +++ b/include/xbps.h.in @@ -2345,26 +2345,24 @@ char *xbps_symlink_target(struct xbps_handle *xhp, const char *path, const char bool xbps_patterns_match(xbps_array_t patterns, const char *path); /** - * Internalizes a plist file declared in \a fname and returns a proplib array. + * Internalizes a plist file declared in \a path and returns a proplib array. * - * @param[in] xhp The pointer to an xbps_handle struct. - * @param[in] fname The file path. + * @param[in] path The file path. * * @return The internalized proplib array, NULL otherwise. */ xbps_array_t -xbps_plist_array_from_file(struct xbps_handle *xhp, const char *fname); +xbps_plist_array_from_file(const char *path); /** - * Internalizes a plist file declared in \a fname and returns a proplib dictionary. + * Internalizes a plist file declared in \a path and returns a proplib dictionary. * - * @param[in] xhp The pointer to an xbps_handle struct. - * @param[in] fname The file path. + * @param[in] path The file path. * * @return The internalized proplib array, NULL otherwise. */ xbps_dictionary_t -xbps_plist_dictionary_from_file(struct xbps_handle *xhp, const char *fname); +xbps_plist_dictionary_from_file(const char *path); /**@}*/ diff --git a/lib/pkgdb.c b/lib/pkgdb.c index 4595a4fc..dae1acbe 100644 --- a/lib/pkgdb.c +++ b/lib/pkgdb.c @@ -496,5 +496,5 @@ xbps_pkgdb_get_pkg_files(struct xbps_handle *xhp, const char *pkg) return NULL; snprintf(plist, sizeof(plist)-1, "%s/.%s-files.plist", xhp->metadir, pkgname); - return xbps_plist_dictionary_from_file(xhp, plist); + return xbps_plist_dictionary_from_file(plist); } diff --git a/lib/proplib_wrapper.c b/lib/proplib_wrapper.c index 09a279ce..65d2cc9d 100644 --- a/lib/proplib_wrapper.c +++ b/lib/proplib_wrapper.c @@ -934,27 +934,27 @@ xbps_string_equals_cstring(xbps_string_t s, const char *ss) /* xbps specific helpers */ xbps_array_t -xbps_plist_array_from_file(struct xbps_handle *xhp, const char *f) +xbps_plist_array_from_file(const char *path) { xbps_array_t a; - a = xbps_array_internalize_from_zfile(f); + a = xbps_array_internalize_from_zfile(path); if (xbps_object_type(a) != XBPS_TYPE_ARRAY) { xbps_dbg_printf( - "xbps: failed to internalize array from %s\n", f); + "xbps: failed to internalize array from %s\n", path); } return a; } xbps_dictionary_t -xbps_plist_dictionary_from_file(struct xbps_handle *xhp, const char *f) +xbps_plist_dictionary_from_file(const char *path) { xbps_dictionary_t d; - d = xbps_dictionary_internalize_from_zfile(f); + d = xbps_dictionary_internalize_from_zfile(path); if (xbps_object_type(d) != XBPS_TYPE_DICTIONARY) { xbps_dbg_printf( - "xbps: failed to internalize dict from %s\n", f); + "xbps: failed to internalize dict from %s\n", path); } return d; } diff --git a/lib/repo.c b/lib/repo.c index 0c37b118..e92ff230 100644 --- a/lib/repo.c +++ b/lib/repo.c @@ -660,7 +660,7 @@ xbps_repo_key_import(struct xbps_repo *repo) * Check if the public key is alredy stored. */ rkeyfile = xbps_xasprintf("%s/keys/%s.plist", repo->xhp->metadir, hexfp); - repokeyd = xbps_plist_dictionary_from_file(repo->xhp, rkeyfile); + repokeyd = xbps_plist_dictionary_from_file(rkeyfile); if (xbps_object_type(repokeyd) == XBPS_TYPE_DICTIONARY) { xbps_dbg_printf("[repo] `%s' public key already stored.\n", repo->uri); goto out; diff --git a/lib/verifysig.c b/lib/verifysig.c index 5679d250..ba51f14b 100644 --- a/lib/verifysig.c +++ b/lib/verifysig.c @@ -98,7 +98,7 @@ xbps_verify_signature(struct xbps_repo *repo, const char *sigfile, * Prepare repository RSA public key to verify fname signature. */ rkeyfile = xbps_xasprintf("%s/keys/%s.plist", repo->xhp->metadir, hexfp); - repokeyd = xbps_plist_dictionary_from_file(repo->xhp, rkeyfile); + repokeyd = xbps_plist_dictionary_from_file(rkeyfile); if (xbps_object_type(repokeyd) != XBPS_TYPE_DICTIONARY) { xbps_dbg_printf("cannot read rkey data at %s: %s\n", rkeyfile, strerror(errno));