diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 248337a9..72fef62e 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -484,7 +484,7 @@ void _alpm_db_free_pkgcache(alpm_db_t *db) _alpm_db_free_grpcache(db); } -pmpkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db) +alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db) { if(db == NULL) { return NULL; @@ -503,7 +503,7 @@ pmpkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db) alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db) { - pmpkghash_t *hash = _alpm_db_get_pkgcache_hash(db); + alpm_pkghash_t *hash = _alpm_db_get_pkgcache_hash(db); if(hash == NULL) { return NULL; @@ -567,7 +567,7 @@ alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target) return NULL; } - pmpkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db); + alpm_pkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db); if(!pkgcache) { return NULL; } diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 2f15c33c..fe264f92 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -65,7 +65,7 @@ struct __alpm_db_t { int is_local; /* flags determining validity, loaded caches, etc. */ enum _pmdbstatus_t status; - pmpkghash_t *pkgcache; + alpm_pkghash_t *pkgcache; alpm_list_t *grpcache; alpm_list_t *servers; pgp_verify_t pgp_verify; @@ -97,7 +97,7 @@ int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info); void _alpm_db_free_pkgcache(alpm_db_t *db); int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg); int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg); -pmpkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db); +alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db); alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db); int _alpm_db_ensure_pkgcache(alpm_db_t *db, pmdbinfrq_t infolevel); alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target); diff --git a/lib/libalpm/pkghash.c b/lib/libalpm/pkghash.c index 2fd82de3..f6207ada 100644 --- a/lib/libalpm/pkghash.c +++ b/lib/libalpm/pkghash.c @@ -51,12 +51,12 @@ static const size_t prime_list[] = }; /* Allocate a hash table with at least "size" buckets */ -pmpkghash_t *_alpm_pkghash_create(size_t size) +alpm_pkghash_t *_alpm_pkghash_create(size_t size) { - pmpkghash_t *hash = NULL; + alpm_pkghash_t *hash = NULL; size_t i, loopsize; - CALLOC(hash, 1, sizeof(pmpkghash_t), return NULL); + CALLOC(hash, 1, sizeof(alpm_pkghash_t), return NULL); loopsize = sizeof(prime_list) / sizeof(*prime_list); for(i = 0; i < loopsize; i++) { @@ -78,7 +78,7 @@ pmpkghash_t *_alpm_pkghash_create(size_t size) return hash; } -static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash) +static size_t get_hash_position(unsigned long name_hash, alpm_pkghash_t *hash) { size_t position; @@ -93,9 +93,9 @@ static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash) } /* Expand the hash table size to the next increment and rebin the entries */ -static pmpkghash_t *rehash(pmpkghash_t *oldhash) +static alpm_pkghash_t *rehash(alpm_pkghash_t *oldhash) { - pmpkghash_t *newhash; + alpm_pkghash_t *newhash; size_t newsize, position, i; /* Hash tables will need resized in two cases: @@ -144,7 +144,7 @@ static pmpkghash_t *rehash(pmpkghash_t *oldhash) return newhash; } -static pmpkghash_t *pkghash_add_pkg(pmpkghash_t *hash, alpm_pkg_t *pkg, int sorted) +static alpm_pkghash_t *pkghash_add_pkg(alpm_pkghash_t *hash, alpm_pkg_t *pkg, int sorted) { alpm_list_t *ptr; size_t position; @@ -179,17 +179,17 @@ static pmpkghash_t *pkghash_add_pkg(pmpkghash_t *hash, alpm_pkg_t *pkg, int sort return hash; } -pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, alpm_pkg_t *pkg) +alpm_pkghash_t *_alpm_pkghash_add(alpm_pkghash_t *hash, alpm_pkg_t *pkg) { return pkghash_add_pkg(hash, pkg, 0); } -pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, alpm_pkg_t *pkg) +alpm_pkghash_t *_alpm_pkghash_add_sorted(alpm_pkghash_t *hash, alpm_pkg_t *pkg) { return pkghash_add_pkg(hash, pkg, 1); } -static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end) +static size_t move_one_entry(alpm_pkghash_t *hash, size_t start, size_t end) { /* Iterate backwards from 'end' to 'start', seeing if any of the items * would hash to 'start'. If we find one, we move it there and break. If @@ -226,7 +226,7 @@ static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end) * * @return the resultant hash */ -pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, alpm_pkg_t *pkg, +alpm_pkghash_t *_alpm_pkghash_remove(alpm_pkghash_t *hash, alpm_pkg_t *pkg, alpm_pkg_t **data) { alpm_list_t *i; @@ -283,7 +283,7 @@ pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, alpm_pkg_t *pkg, return hash; } -void _alpm_pkghash_free(pmpkghash_t *hash) +void _alpm_pkghash_free(alpm_pkghash_t *hash) { size_t i; if(hash != NULL) { @@ -295,7 +295,7 @@ void _alpm_pkghash_free(pmpkghash_t *hash) free(hash); } -alpm_pkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name) +alpm_pkg_t *_alpm_pkghash_find(alpm_pkghash_t *hash, const char *name) { alpm_list_t *lp; unsigned long name_hash; diff --git a/lib/libalpm/pkghash.h b/lib/libalpm/pkghash.h index ab8fef0c..edd500e9 100644 --- a/lib/libalpm/pkghash.h +++ b/lib/libalpm/pkghash.h @@ -32,7 +32,7 @@ * A combination of a hash table and a list, allowing for fast look-up * by package name but also iteration over the packages. */ -struct __pmpkghash_t { +struct __alpm_pkghash_t { /** data held by the hash table */ alpm_list_t **hash_table; /** number of buckets in hash table */ @@ -43,17 +43,17 @@ struct __pmpkghash_t { alpm_list_t *list; }; -typedef struct __pmpkghash_t pmpkghash_t; +typedef struct __alpm_pkghash_t alpm_pkghash_t; -pmpkghash_t *_alpm_pkghash_create(size_t size); +alpm_pkghash_t *_alpm_pkghash_create(size_t size); -pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, alpm_pkg_t *pkg); -pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, alpm_pkg_t *pkg); -pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, alpm_pkg_t *pkg, alpm_pkg_t **data); +alpm_pkghash_t *_alpm_pkghash_add(alpm_pkghash_t *hash, alpm_pkg_t *pkg); +alpm_pkghash_t *_alpm_pkghash_add_sorted(alpm_pkghash_t *hash, alpm_pkg_t *pkg); +alpm_pkghash_t *_alpm_pkghash_remove(alpm_pkghash_t *hash, alpm_pkg_t *pkg, alpm_pkg_t **data); -void _alpm_pkghash_free(pmpkghash_t *hash); +void _alpm_pkghash_free(alpm_pkghash_t *hash); -alpm_pkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name); +alpm_pkg_t *_alpm_pkghash_find(alpm_pkghash_t *hash, const char *name); #define MAX_HASH_LOAD 0.7