Misc cleanups and performance improvements.

- There's no need to check rval for prop_dictionary_get_*, we are sure the
  objects are there at prop_dictionary_set_* time.
- Avoid two chdir(2) calls per INSTALL/REMOVE run.
- Avoid using access(2) to check for existence of INSTALL/REMOVE scripts,
  just try to run the executable directly and check for ENOENT.
This commit is contained in:
Juan RP
2010-11-06 06:44:00 +01:00
parent f8629652da
commit ec7cdde1e0
22 changed files with 228 additions and 461 deletions

View File

@@ -161,9 +161,7 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
char *rdepname;
int rv = 0;
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver))
return errno;
prop_dictionary_get_cstring_nocopy(pkg, "pkgver", &pkgver);
rdeps = prop_dictionary_get(pkg, "run_depends");
if (rdeps == NULL || prop_array_count(rdeps) == 0)
return EINVAL;
@@ -195,13 +193,8 @@ xbps_requiredby_pkg_add(prop_array_t regar, prop_dictionary_t pkg)
* current run dependency.
*/
while ((obj2 = prop_object_iterator_next(iter2)) != NULL) {
if (!prop_dictionary_get_cstring_nocopy(obj2,
"pkgname", &reqname)) {
free(rdepname);
prop_object_iterator_release(iter2);
rv = errno;
goto out;
}
prop_dictionary_get_cstring_nocopy(obj2,
"pkgname", &reqname);
if (strcmp(rdepname, reqname) == 0) {
rv = add_pkg_into_reqby(obj2, pkgver);
if (rv == EEXIST)