From 177beb91c96a078f729bd11c2f6c1144082e69e3 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 2 Jan 2012 13:17:44 -0600 Subject: [PATCH] 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 --- lib/libalpm/be_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index da2260e8..07134e79 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -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); -- 2.11.4.GIT