1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Minor optimization on likely sync package lookup

We have a name_hash value here, so add a cheap compare of it before
falling to the strcmp() call.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2012-01-02 13:17:44 -06:00
parent 29e94dc065
commit 177beb91c9

View File

@ -318,7 +318,8 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
return NULL;
}
if(likely_pkg && strcmp(likely_pkg->name, pkgname) == 0) {
if(likely_pkg && pkgname_hash == likely_pkg->name_hash
&& strcmp(likely_pkg->name, pkgname) == 0) {
pkg = likely_pkg;
} else {
pkg = _alpm_pkghash_find(db->pkgcache, pkgname);