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:
@@ -54,22 +54,15 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
if (plist == NULL)
|
||||
return EINVAL;
|
||||
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkgrd, "pkgname", &pkgname)) {
|
||||
free(plist);
|
||||
return EINVAL;
|
||||
}
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkgrd, "version", &version)) {
|
||||
free(plist);
|
||||
return EINVAL;
|
||||
}
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkgrd, "short_desc", &desc)) {
|
||||
free(plist);
|
||||
return EINVAL;
|
||||
}
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkgrd, "pkgver", &pkgver)) {
|
||||
free(plist);
|
||||
return EINVAL;
|
||||
}
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "version", &version);
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "short_desc", &desc);
|
||||
prop_dictionary_get_cstring_nocopy(pkgrd, "pkgver", &pkgver);
|
||||
|
||||
assert(pkgname != NULL);
|
||||
assert(version != NULL);
|
||||
assert(desc != NULL);
|
||||
assert(pkgver != NULL);
|
||||
|
||||
if ((dict = prop_dictionary_internalize_from_zfile(plist)) != NULL) {
|
||||
pkgd = xbps_find_pkg_in_dict_by_name(dict,
|
||||
|
Reference in New Issue
Block a user