Skip to content

Commit

Permalink
lib: remove useless xbps_pkg_has_rundeps function
Browse files Browse the repository at this point in the history
In the only place where this was required it doesn't have any effect and
results in going through the package directory twice to receive and use
the array after checking separately if it exists.
  • Loading branch information
Duncaen committed Nov 12, 2023
1 parent b3026da commit 96db706
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
3 changes: 0 additions & 3 deletions bin/xbps-pkgdb/check_pkg_rundeps.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
const char *reqpkg = NULL;
int rv = 0;

if (!xbps_pkg_has_rundeps(pkg_propsd))
return 0;

array = xbps_dictionary_get(pkg_propsd, "run_depends");
for (unsigned int i = 0; i < xbps_array_count(array); i++) {
xbps_array_get_cstring_nocopy(array, i, &reqpkg);
Expand Down
9 changes: 0 additions & 9 deletions include/xbps.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2155,15 +2155,6 @@ int xbps_pkgpattern_match(const char *pkgver, const char *pattern);
*/
const char *xbps_pkg_revision(const char *pkg);

/**
* Checks if a package has run dependencies.
*
* @param[in] dict Package dictionary.
*
* @return True if package has run dependencies, false otherwise.
*/
bool xbps_pkg_has_rundeps(xbps_dictionary_t dict);

/**
* Returns true if provided string is valid for target architecture.
*
Expand Down
14 changes: 0 additions & 14 deletions lib/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,20 +418,6 @@ xbps_remote_binpkg_exists(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
return access(path, R_OK) == 0;
}

bool
xbps_pkg_has_rundeps(xbps_dictionary_t pkgd)
{
xbps_array_t array;

assert(xbps_object_type(pkgd) == XBPS_TYPE_DICTIONARY);

array = xbps_dictionary_get(pkgd, "run_depends");
if (xbps_array_count(array))
return true;

return false;
}

bool
xbps_pkg_arch_match(struct xbps_handle *xhp, const char *orig,
const char *target)
Expand Down

0 comments on commit 96db706

Please sign in to comment.