lib: remove xhp argument from xbps_plist_{array,dictionary}_from_file

This commit is contained in:
Duncan Overbruck 2022-12-24 13:58:36 +01:00
parent de484e9369
commit 9efba6749f
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35
7 changed files with 17 additions and 19 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);
/**@}*/

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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));