diff options
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/be_package.c | 1 | ||||
-rw-r--r-- | lib/libalpm/package.c | 1 | ||||
-rw-r--r-- | lib/libalpm/package.h | 1 | ||||
-rw-r--r-- | lib/libalpm/util.c | 1 |
4 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index ae951945..32ec9934 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -179,6 +179,7 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg) ptr = _alpm_strtrim(ptr); if(strcmp(key, "pkgname") == 0) { STRDUP(newpkg->name, ptr, RET_ERR(PM_ERR_MEMORY, -1)); + newpkg->name_hash = _alpm_hash_sdbm(newpkg->name); } else if(strcmp(key, "pkgver") == 0) { STRDUP(newpkg->version, ptr, RET_ERR(PM_ERR_MEMORY, -1)); } else if(strcmp(key, "pkgdesc") == 0) { diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 57ab9a67..5b479b4f 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -414,6 +414,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg) CALLOC(newpkg, 1, sizeof(pmpkg_t), RET_ERR(PM_ERR_MEMORY, NULL)); + newpkg->name_hash = pkg->name_hash; STRDUP(newpkg->filename, pkg->filename, RET_ERR(PM_ERR_MEMORY, newpkg)); STRDUP(newpkg->name, pkg->name, RET_ERR(PM_ERR_MEMORY, newpkg)); STRDUP(newpkg->version, pkg->version, RET_ERR(PM_ERR_MEMORY, newpkg)); diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index 9a6f0cb9..d1abb55f 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -89,6 +89,7 @@ struct pkg_operations { extern struct pkg_operations default_pkg_ops; struct __pmpkg_t { + unsigned long name_hash; char *filename; char *name; char *version; diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 8e83bdac..1291ea0f 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -840,6 +840,7 @@ int _alpm_splitname(const char *target, pmpkg_t *pkg) FREE(pkg->name); } STRDUP(pkg->name, tmp, RET_ERR(PM_ERR_MEMORY, -1)); + pkg->name_hash = _alpm_hash_sdbm(pkg->name); free(tmp); return(0); |