[pacman-dev] [PATCH 02/10] Remove unnecessary handle != NULL asserts

Dan McGee dan at archlinux.org
Fri Jun 3 14:21:40 EDT 2011


These are simple accessor functions for a struct; the handle never even
comes into play when calling these functions.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/conflict.c |    7 -------
 lib/libalpm/db.c       |    8 --------
 2 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 995c6cb..12a68cf 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -508,7 +508,6 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmdb_t *db, pmtrans_t *trans,
 const char SYMEXPORT *alpm_conflict_get_package1(pmconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(conflict != NULL, return NULL);
 
 	return conflict->package1;
@@ -517,7 +516,6 @@ const char SYMEXPORT *alpm_conflict_get_package1(pmconflict_t *conflict)
 const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(conflict != NULL, return NULL);
 
 	return conflict->package2;
@@ -526,7 +524,6 @@ const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
 const char SYMEXPORT *alpm_conflict_get_reason(pmconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(conflict != NULL, return NULL);
 
 	return conflict->reason;
@@ -535,7 +532,6 @@ const char SYMEXPORT *alpm_conflict_get_reason(pmconflict_t *conflict)
 const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(conflict != NULL, return NULL);
 
 	return conflict->target;
@@ -544,7 +540,6 @@ const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
 pmfileconflicttype_t SYMEXPORT alpm_fileconflict_get_type(pmfileconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return -1);
 	ASSERT(conflict != NULL, return -1);
 
 	return conflict->type;
@@ -553,7 +548,6 @@ pmfileconflicttype_t SYMEXPORT alpm_fileconflict_get_type(pmfileconflict_t *conf
 const char SYMEXPORT *alpm_fileconflict_get_file(pmfileconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(conflict != NULL, return NULL);
 
 	return conflict->file;
@@ -562,7 +556,6 @@ const char SYMEXPORT *alpm_fileconflict_get_file(pmfileconflict_t *conflict)
 const char SYMEXPORT *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(conflict != NULL, return NULL);
 
 	return conflict->ctarget;
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 94173a2..a158723 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -230,7 +230,6 @@ int SYMEXPORT alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify)
 const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 
 	return db->treename;
@@ -242,7 +241,6 @@ const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
 	char *url;
 
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 	ASSERT(db->servers != NULL, return NULL);
 
@@ -256,7 +254,6 @@ const char SYMEXPORT *alpm_db_get_url(const pmdb_t *db)
 pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 	ASSERT(name != NULL && strlen(name) != 0, return NULL);
 
@@ -267,7 +264,6 @@ pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
 alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 
 	return _alpm_db_get_pkgcache(db);
@@ -277,7 +273,6 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
 pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 	ASSERT(name != NULL && strlen(name) != 0, return NULL);
 
@@ -288,7 +283,6 @@ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
 alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 
 	return _alpm_db_get_grpcache(db);
@@ -298,7 +292,6 @@ alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
 alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, return NULL);
 	ASSERT(db != NULL, return NULL);
 
 	return _alpm_db_search(db, needles);
@@ -308,7 +301,6 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
 int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason)
 {
 	/* Sanity checks */
-	ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
 	ASSERT(db != NULL && name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
 
 	pmpkg_t *pkg = _alpm_db_get_pkgfromcache(db, name);
-- 
1.7.5.2



More information about the pacman-dev mailing list