diff --git a/lib/install.c b/lib/install.c index 3e1c795e6c3..b4d31e8b25a 100644 --- a/lib/install.c +++ b/lib/install.c @@ -271,6 +271,8 @@ xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg, int rv; assert(pkg != NULL); + assert(repo != NULL); + assert(cb != NULL); /* Append filename to the full path for binary pkg */ filename = prop_dictionary_get(pkg, "filename"); diff --git a/lib/plist.c b/lib/plist.c index 9b7d4e3d057..b42ee1c5797 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -42,7 +42,9 @@ bool xbps_add_obj_to_dict(prop_dictionary_t dict, prop_object_t obj, const char *key) { - assert(dict != NULL || obj != NULL || key != NULL); + assert(dict != NULL); + assert(obj != NULL); + assert(key != NULL); if (!prop_dictionary_set(dict, key, obj)) { prop_object_release(dict); @@ -56,7 +58,8 @@ xbps_add_obj_to_dict(prop_dictionary_t dict, prop_object_t obj, bool xbps_add_obj_to_array(prop_array_t array, prop_object_t obj) { - assert(array != NULL || obj != NULL); + assert(array != NULL); + assert(obj != NULL); if (!prop_array_add(array, obj)) { prop_object_release(array); @@ -77,6 +80,10 @@ xbps_callback_array_iter_in_dict(prop_dictionary_t dict, const char *key, int rv = 0; bool run, cbloop_done; + assert(dict != NULL); + assert(key != NULL); + assert(func != NULL); + run = cbloop_done = false; assert(func != NULL); @@ -129,6 +136,7 @@ xbps_find_pkg_in_dict(prop_dictionary_t dict, const char *pkgname) prop_object_t obj; const char *dpkgn; + assert(dict != NULL); assert(pkgname != NULL); iter = xbps_get_array_iter_from_dict(dict, "packages"); @@ -151,7 +159,8 @@ xbps_find_string_in_array(prop_array_t array, const char *val) prop_object_iterator_t iter; prop_object_t obj; - assert(array != NULL || val != NULL); + assert(array != NULL); + assert(val != NULL); iter = prop_array_iterator(array); if (iter == NULL) @@ -175,7 +184,8 @@ xbps_get_array_iter_from_dict(prop_dictionary_t dict, const char *key) { prop_array_t array; - assert(dict != NULL || key != NULL); + assert(dict != NULL); + assert(key != NULL); array = prop_dictionary_get(dict, key); if (array == NULL || prop_object_type(array) != PROP_TYPE_ARRAY) @@ -194,6 +204,9 @@ xbps_remove_pkg_dict_from_file(const char *pkg, const char *plist) const char *curpkg; size_t i = 0; + assert(pkg != NULL); + assert(plist != NULL); + pdict = prop_dictionary_internalize_from_file(plist); if (pdict == NULL) return false; @@ -399,8 +412,7 @@ xbps_show_pkg_info(prop_dictionary_t dict) int rv = 0; assert(dict != NULL); - if (prop_dictionary_count(dict) == 0) - return; + assert(prop_dictionary_count(dict) != 0); obj = prop_dictionary_get(dict, "pkgname"); if (obj && prop_object_type(obj) == PROP_TYPE_STRING) diff --git a/lib/util.c b/lib/util.c index 77fd2976625..5051a332cb0 100644 --- a/lib/util.c +++ b/lib/util.c @@ -37,6 +37,8 @@ xbps_get_pkg_version(const char *pkg) { const char *tmp; + assert(pkg != NULL); + /* Get the required version */ tmp = strrchr(pkg, '-'); assert(tmp != NULL); @@ -50,6 +52,8 @@ xbps_get_pkg_name(const char *pkg) char *pkgname; size_t len = 0; + assert(pkg != NULL); + /* Get the required version */ tmp = strrchr(pkg, '-'); assert(tmp != NULL);