[pacman-dev] [PATCH 1/3] Rename public functions with grp in their name

Allan McRae allan at archlinux.org
Wed Jun 29 02:05:27 EDT 2011


Using grp instead of group is a small saving at the cost of clarity.
Rename the following functions:

  alpm_option_get_ignoregrps -> alpm_option_get_ignoregroups
  alpm_option_add_ignoregrp -> alpm_option_add_ignoregroup
  alpm_option_set_ignoregrps -> alpm_option_set_ignoregroups
  alpm_option_remove_ignoregrp -> alpm_option_remove_ignoregroup
  alpm_db_readgrp -> alpm_db_readgroup
  alpm_db_get_grpcache -> alpm_db_get_groupcache
  alpm_find_grp_pkgs -> alpm_find_group_pkgs

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/alpm.h   |   14 +++++++-------
 lib/libalpm/db.c     |   10 +++++-----
 lib/libalpm/db.h     |    2 +-
 lib/libalpm/handle.c |    8 ++++----
 lib/libalpm/sync.c   |    4 ++--
 src/pacman/conf.c    |    2 +-
 src/pacman/query.c   |    4 ++--
 src/pacman/remove.c  |    2 +-
 src/pacman/sync.c    |    6 +++---
 9 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 54a9ba4..33707dd 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -311,10 +311,10 @@ int alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg);
  * should be ignored by a sysupgrade.
  * @{
  */
-alpm_list_t *alpm_option_get_ignoregrps(alpm_handle_t *handle);
-int alpm_option_add_ignoregrp(alpm_handle_t *handle, const char *grp);
-int alpm_option_set_ignoregrps(alpm_handle_t *handle, alpm_list_t *ignoregrps);
-int alpm_option_remove_ignoregrp(alpm_handle_t *handle, const char *grp);
+alpm_list_t *alpm_option_get_ignoregroups(alpm_handle_t *handle);
+int alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp);
+int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps);
+int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp);
 /** @} */
 
 /** Returns the targeted architecture. */
@@ -411,13 +411,13 @@ alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db);
  * @param name of the group
  * @return the groups entry on success, NULL on error
  */
-alpm_group_t *alpm_db_readgrp(alpm_db_t *db, const char *name);
+alpm_group_t *alpm_db_readgroup(alpm_db_t *db, const char *name);
 
 /** Get the group cache of a package database.
  * @param db pointer to the package database to get the group from
  * @return the list of groups on success, NULL on error
  */
-alpm_list_t *alpm_db_get_grpcache(alpm_db_t *db);
+alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db);
 
 /** Searches a database with regular expressions.
  * @param db pointer to the package database to search in
@@ -700,7 +700,7 @@ int alpm_db_check_pgp_signature(alpm_db_t *db);
  * Groups
  */
 
-alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name);
+alpm_list_t *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name);
 
 /*
  * Sync
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 72fef62..ecb792c 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -239,7 +239,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db)
 }
 
 /** Get a group entry from a package database. */
-alpm_group_t SYMEXPORT *alpm_db_readgrp(alpm_db_t *db, const char *name)
+alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name)
 {
 	ASSERT(db != NULL, return NULL);
 	db->handle->pm_errno = 0;
@@ -250,12 +250,12 @@ alpm_group_t SYMEXPORT *alpm_db_readgrp(alpm_db_t *db, const char *name)
 }
 
 /** Get the group cache of a package database. */
-alpm_list_t SYMEXPORT *alpm_db_get_grpcache(alpm_db_t *db)
+alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
 {
 	ASSERT(db != NULL, return NULL);
 	db->handle->pm_errno = 0;
 
-	return _alpm_db_get_grpcache(db);
+	return _alpm_db_get_groupcache(db);
 }
 
 /** Searches a database. */
@@ -646,7 +646,7 @@ void _alpm_db_free_grpcache(alpm_db_t *db)
 	db->status &= ~DB_STATUS_GRPCACHE;
 }
 
-alpm_list_t *_alpm_db_get_grpcache(alpm_db_t *db)
+alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db)
 {
 	if(db == NULL) {
 		return NULL;
@@ -671,7 +671,7 @@ alpm_group_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target)
 		return NULL;
 	}
 
-	for(i = _alpm_db_get_grpcache(db); i; i = i->next) {
+	for(i = _alpm_db_get_groupcache(db); i; i = i->next) {
 		alpm_group_t *info = i->data;
 
 		if(strcmp(info->name, target) == 0) {
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index 10464b5..5bf05d8 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -103,7 +103,7 @@ int _alpm_db_ensure_pkgcache(alpm_db_t *db, alpm_dbinfrq_t infolevel);
 alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target);
 /* groups */
 void _alpm_db_free_grpcache(alpm_db_t *db);
-alpm_list_t *_alpm_db_get_grpcache(alpm_db_t *db);
+alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db);
 alpm_group_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target);
 
 #endif /* _ALPM_DB_H */
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index bb2ce50..62b2d9a 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -224,7 +224,7 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(alpm_handle_t *handle)
 	return handle->ignorepkg;
 }
 
-alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps(alpm_handle_t *handle)
+alpm_list_t SYMEXPORT *alpm_option_get_ignoregroups(alpm_handle_t *handle)
 {
 	CHECK_HANDLE(handle, return NULL);
 	return handle->ignoregrp;
@@ -521,14 +521,14 @@ int SYMEXPORT alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pk
 	return 0;
 }
 
-int SYMEXPORT alpm_option_add_ignoregrp(alpm_handle_t *handle, const char *grp)
+int SYMEXPORT alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp)
 {
 	CHECK_HANDLE(handle, return -1);
 	handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
 	return 0;
 }
 
-int SYMEXPORT alpm_option_set_ignoregrps(alpm_handle_t *handle, alpm_list_t *ignoregrps)
+int SYMEXPORT alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps)
 {
 	CHECK_HANDLE(handle, return -1);
 	if(handle->ignoregrp) FREELIST(handle->ignoregrp);
@@ -536,7 +536,7 @@ int SYMEXPORT alpm_option_set_ignoregrps(alpm_handle_t *handle, alpm_list_t *ign
 	return 0;
 }
 
-int SYMEXPORT alpm_option_remove_ignoregrp(alpm_handle_t *handle, const char *grp)
+int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp)
 {
 	char *vdata = NULL;
 	CHECK_HANDLE(handle, return -1);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 3775348..dcce18d 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -213,14 +213,14 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
  * @pram name the name of the group
  * @return the list of alpm_pkg_t * (caller is responsible for alpm_list_free)
  */
-alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs,
+alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
 		const char *name)
 {
 	alpm_list_t *i, *j, *pkgs = NULL, *ignorelist = NULL;
 
 	for(i = dbs; i; i = i->next) {
 		alpm_db_t *db = i->data;
-		alpm_group_t *grp = alpm_db_readgrp(db, name);
+		alpm_group_t *grp = alpm_db_readgroup(db, name);
 
 		if(!grp)
 			continue;
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 368e71f..50b4988 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -502,7 +502,7 @@ static int setup_libalpm(void)
 	alpm_option_set_usedelta(handle, config->usedelta);
 
 	alpm_option_set_ignorepkgs(handle, config->ignorepkg);
-	alpm_option_set_ignoregrps(handle, config->ignoregrp);
+	alpm_option_set_ignoregroups(handle, config->ignoregrp);
 	alpm_option_set_noupgrades(handle, config->noupgrade);
 	alpm_option_set_noextracts(handle, config->noextract);
 
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 0a420c7..826c226 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -302,7 +302,7 @@ static int query_group(alpm_list_t *targets)
 	alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
 
 	if(targets == NULL) {
-		for(j = alpm_db_get_grpcache(db_local); j; j = alpm_list_next(j)) {
+		for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) {
 			alpm_group_t *grp = alpm_list_getdata(j);
 			const alpm_list_t *p;
 
@@ -315,7 +315,7 @@ static int query_group(alpm_list_t *targets)
 		for(i = targets; i; i = alpm_list_next(i)) {
 			alpm_group_t *grp;
 			grpname = alpm_list_getdata(i);
-			grp = alpm_db_readgrp(db_local, grpname);
+			grp = alpm_db_readgroup(db_local, grpname);
 			if(grp) {
 				const alpm_list_t *p;
 				for(p = grp->packages; p; p = alpm_list_next(p)) {
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index d48b038..4a23ab2 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -47,7 +47,7 @@ static int remove_target(const char *target)
 	}
 
 		/* fallback to group */
-	alpm_group_t *grp = alpm_db_readgrp(db_local, target);
+	alpm_group_t *grp = alpm_db_readgroup(db_local, target);
 	if(grp == NULL) {
 		pm_fprintf(stderr, PM_LOG_ERROR, "'%s': target not found\n", target);
 		return -1;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 20be450..ce57d3c 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -398,7 +398,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
 			const char *grpname = alpm_list_getdata(i);
 			for(j = syncs; j; j = alpm_list_next(j)) {
 				alpm_db_t *db = alpm_list_getdata(j);
-				alpm_group_t *grp = alpm_db_readgrp(db, grpname);
+				alpm_group_t *grp = alpm_db_readgroup(db, grpname);
 
 				if(grp) {
 					/* get names of packages in group */
@@ -417,7 +417,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
 		for(i = syncs; i; i = alpm_list_next(i)) {
 			alpm_db_t *db = alpm_list_getdata(i);
 
-			for(j = alpm_db_get_grpcache(db); j; j = alpm_list_next(j)) {
+			for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) {
 				alpm_group_t *grp = alpm_list_getdata(j);
 
 				if(level > 1) {
@@ -634,7 +634,7 @@ static int process_group(alpm_list_t *dbs, char *group)
 {
 	int ret = 0;
 	alpm_list_t *i;
-	alpm_list_t *pkgs = alpm_find_grp_pkgs(dbs, group);
+	alpm_list_t *pkgs = alpm_find_group_pkgs(dbs, group);
 	int count = alpm_list_count(pkgs);
 
 	if(!count) {
-- 
1.7.6



More information about the pacman-dev mailing list