Introduce xbps_plist_{array,dictionary}_from_file().

Those are a wrapper around xbps_{array,dictionary}_internalize_from_zfile()
that prints a debugging msg when the plist file cannot be internalized.

Update xbps to use these wrappers.
This commit is contained in:
Juan RP
2015-05-28 10:15:05 +02:00
parent c4ed1b5845
commit 769a997afb
9 changed files with 59 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2013 Juan Romero Pardines.
* Copyright (c) 2013-2015 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -931,3 +931,30 @@ xbps_string_equals_cstring(xbps_string_t s, const char *ss)
{
return prop_string_equals_cstring(s, ss);
}
/* xbps specific helpers */
xbps_array_t
xbps_plist_array_from_file(struct xbps_handle *xhp, const char *f)
{
xbps_array_t a;
a = xbps_array_internalize_from_zfile(f);
if (xbps_object_type(a) != XBPS_TYPE_ARRAY) {
xbps_dbg_printf(xhp,
"xbps: failed to internalize array from %s\n", f);
}
return a;
}
xbps_dictionary_t
xbps_plist_dictionary_from_file(struct xbps_handle *xhp, const char *f)
{
xbps_dictionary_t d;
d = xbps_dictionary_internalize_from_zfile(f);
if (xbps_object_type(d) != XBPS_TYPE_DICTIONARY) {
xbps_dbg_printf(xhp,
"xbps: failed to internalize dict from %s\n", f);
}
return d;
}