mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-14 21:35:02 -05:00
Remove lazy init code from pkg name and version functions
If we have a package without name and/or version, we are really out of luck. Speed these functions up by removing unnecessary code. Note that both the splitname and pkg_load functions, where the name and version of packages are initially populated for databases and pkg.tar.gz files respectively, enforce that every new package struct created has a name and version. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
f671147282
commit
a422f6e39c
@ -130,29 +130,13 @@ const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
|
|||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(pkg != NULL, return(NULL));
|
ASSERT(pkg != NULL, return(NULL));
|
||||||
|
|
||||||
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_BASE)) {
|
|
||||||
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_BASE);
|
|
||||||
}
|
|
||||||
return pkg->name;
|
return pkg->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
ALPM_LOG_FUNC;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(pkg != NULL, return(NULL));
|
ASSERT(pkg != NULL, return(NULL));
|
||||||
|
|
||||||
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_BASE)) {
|
|
||||||
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_BASE);
|
|
||||||
}
|
|
||||||
return pkg->version;
|
return pkg->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user