[pacman-dev] [PATCH 1/2] alpm: remove public visibility of pmpkghash_t

Dave Reisner d at falconindy.com
Fri Feb 25 09:29:46 EST 2011


There's no API functions exposed which allow manipulation of this type,
so remove it from public view. Also, rename the public and private
alpm_db_get_pkgcache symbol to alpm_db_get_pkgcache_has.

Signed-off-by: Dave Reisner <d at falconindy.com>
---
 lib/libalpm/alpm.h    |    2 --
 lib/libalpm/db.c      |   21 +++------------------
 lib/libalpm/db.h      |    2 +-
 lib/libalpm/deps.c    |    2 +-
 lib/libalpm/pkghash.h |    2 ++
 5 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 7fec293..03d129a 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -52,7 +52,6 @@ typedef struct __pmdepend_t pmdepend_t;
 typedef struct __pmdepmissing_t pmdepmissing_t;
 typedef struct __pmconflict_t pmconflict_t;
 typedef struct __pmfileconflict_t pmfileconflict_t;
-typedef struct __pmpkghash_t pmpkghash_t;
 
 /*
  * Library
@@ -187,7 +186,6 @@ int alpm_db_setserver(pmdb_t *db, const char *url);
 int alpm_db_update(int level, pmdb_t *db);
 
 pmpkg_t *alpm_db_get_pkg(pmdb_t *db, const char *name);
-pmpkghash_t *alpm_db_get_pkgcache(pmdb_t *db);
 alpm_list_t *alpm_db_get_pkgcache_list(pmdb_t *db);
 
 pmgrp_t *alpm_db_readgrp(pmdb_t *db, const char *name);
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 02f8282..bf65406 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -249,21 +249,6 @@ pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
 
 /** Get the package cache of a package database
  * @param db pointer to the package database to get the package from
- * @return the hash of packages on success, NULL on error
- */
-pmpkghash_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
-{
-	ALPM_LOG_FUNC;
-
-	/* Sanity checks */
-	ASSERT(handle != NULL, return(NULL));
-	ASSERT(db != NULL, return(NULL));
-
-	return(_alpm_db_get_pkgcache(db));
-}
-
-/** Get the package cache of a package database
- * @param db pointer to the package database to get the package from
  * @return the list of packages on success, NULL on error
  */
 alpm_list_t SYMEXPORT *alpm_db_get_pkgcache_list(pmdb_t *db)
@@ -546,7 +531,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
 	_alpm_db_free_grpcache(db);
 }
 
-pmpkghash_t *_alpm_db_get_pkgcache(pmdb_t *db)
+pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db)
 {
 	ALPM_LOG_FUNC;
 
@@ -570,7 +555,7 @@ alpm_list_t *_alpm_db_get_pkgcache_list(pmdb_t *db)
 {
 	ALPM_LOG_FUNC;
 
-	pmpkghash_t *hash = _alpm_db_get_pkgcache(db);
+	pmpkghash_t *hash = _alpm_db_get_pkgcache_hash(db);
 
 	if(hash == NULL) {
 		return(NULL);
@@ -640,7 +625,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
 		return(NULL);
 	}
 
-	pmpkghash_t *pkgcache = _alpm_db_get_pkgcache(db);
+	pmpkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db);
 	if(!pkgcache) {
 		_alpm_log(PM_LOG_DEBUG, "warning: failed to get '%s' from NULL pkgcache\n",
 				target);
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index c5b3db6..02a91f1 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -86,7 +86,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db);
 void _alpm_db_free_pkgcache(pmdb_t *db);
 int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
 int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
-pmpkghash_t *_alpm_db_get_pkgcache(pmdb_t *db);
+pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db);
 alpm_list_t *_alpm_db_get_pkgcache_list(pmdb_t *db);
 int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
 pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index dca8877..5c60864 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -614,7 +614,7 @@ pmpkg_t *_alpm_resolvedep(pmdepend_t *dep, alpm_list_t *dbs,
 	/* first check if one provider is already installed locally */
 	for(i = providers; i; i = i->next) {
 		pmpkg_t *pkg = i->data;
-		if (_alpm_pkghash_find(_alpm_db_get_pkgcache(handle->db_local), pkg->name)) {
+		if (_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) {
 			alpm_list_free(providers);
 			return(pkg);
 		}
diff --git a/lib/libalpm/pkghash.h b/lib/libalpm/pkghash.h
index a6c1db7..617e60b 100644
--- a/lib/libalpm/pkghash.h
+++ b/lib/libalpm/pkghash.h
@@ -43,6 +43,8 @@ struct __pmpkghash_t {
 	alpm_list_t *list;
 };
 
+typedef struct __pmpkghash_t pmpkghash_t;
+
 pmpkghash_t *_alpm_pkghash_create(size_t size);
 
 pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg);
-- 
1.7.4.1



More information about the pacman-dev mailing list