Extend assertions by checking passed in proplib type.

This commit is contained in:
Juan RP
2011-10-19 16:53:38 +02:00
parent a80df68b15
commit 9fb3c38aa2
17 changed files with 55 additions and 31 deletions

View File

@ -59,7 +59,7 @@ set_new_state(prop_dictionary_t dict, pkg_state_t state)
const struct state *stp;
const char *pkgname;
assert(dict != NULL);
assert(prop_object_type(dict) == PROP_TYPE_DICTIONARY);
for (stp = states; stp->string != NULL; stp++)
if (state == stp->number)
@ -85,7 +85,7 @@ get_state(prop_dictionary_t dict)
const struct state *stp;
const char *state_str;
assert(dict != NULL);
assert(prop_object_type(dict) == PROP_TYPE_DICTIONARY);
if (!prop_dictionary_get_cstring_nocopy(dict,
"state", &state_str))
@ -121,7 +121,7 @@ xbps_pkg_state_installed(const char *pkgname, pkg_state_t *state)
int
xbps_pkg_state_dictionary(prop_dictionary_t dict, pkg_state_t *state)
{
assert(dict != NULL);
assert(prop_object_type(dict) == PROP_TYPE_DICTIONARY);
assert(state != NULL);
if ((*state = get_state(dict)) == 0)
@ -133,7 +133,7 @@ xbps_pkg_state_dictionary(prop_dictionary_t dict, pkg_state_t *state)
int
xbps_set_pkg_state_dictionary(prop_dictionary_t dict, pkg_state_t state)
{
assert(dict != NULL);
assert(prop_object_type(dict) == PROP_TYPE_DICTIONARY);
return set_new_state(dict, state);
}