[pacman-dev] [PATCH v2] Fix brace coding style issues

Michael Straube straubem at gmx.de
Sat Jul 15 12:56:30 UTC 2017


- Add missing braces to one-line if blocks
- Move opening brace to line end

Signed-off-by: Michael Straube <straubem at gmx.de>
---
 lib/libalpm/delta.c |  3 +--
 lib/libalpm/sync.c  |  6 ++++--
 src/pacman/util.c   | 12 ++++++++----
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 89bc32ff..0138aac1 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -238,8 +238,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
 	for(i = vertices; i; i = i->next) {
 		alpm_graph_t *v = i->data;
 		alpm_delta_t *vdelta = v->data;
-		if(strcmp(vdelta->to, to) == 0)
-		{
+		if(strcmp(vdelta->to, to) == 0) {
 			v->weight = vdelta->download_size;
 		}
 	}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index ae0f1e49..73120b63 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -271,8 +271,9 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
 		alpm_db_t *db = i->data;
 		alpm_group_t *grp = alpm_db_get_group(db, name);
 
-		if(!grp)
+		if(!grp) {
 			continue;
+		}
 
 		for(j = grp->packages; j; j = j->next) {
 			alpm_pkg_t *pkg = j->data;
@@ -288,8 +289,9 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
 				};
 				ignorelist = alpm_list_add(ignorelist, pkg);
 				QUESTION(db->handle, &question);
-				if(!question.install)
+				if(!question.install) {
 					continue;
+				}
 			}
 			if(!alpm_pkg_find(pkgs, pkg->name)) {
 				pkgs = alpm_list_add(pkgs, pkg);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index ae8a74d3..9784d627 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1299,8 +1299,9 @@ void select_display(const alpm_list_t *pkglist)
 		alpm_pkg_t *pkg = i->data;
 		alpm_db_t *db = alpm_pkg_get_db(pkg);
 
-		if(!dbname)
+		if(!dbname) {
 			dbname = alpm_db_get_name(db);
+		}
 		if(strcmp(alpm_db_get_name(db), dbname) != 0) {
 			display_repo_list(dbname, list, cols);
 			FREELIST(list);
@@ -1349,8 +1350,9 @@ static int multiselect_parse(char *array, int count, char *response)
 			break;
 		}
 		len = strtrim(starts);
-		if(len == 0)
+		if(len == 0) {
 			continue;
+		}
 
 		if(*starts == '^') {
 			starts++;
@@ -1370,8 +1372,9 @@ static int multiselect_parse(char *array, int count, char *response)
 			}
 		}
 
-		if(parseindex(starts, &start, 1, count) != 0)
+		if(parseindex(starts, &start, 1, count) != 0) {
 			return -1;
+		}
 
 		if(!ends) {
 			array[start - 1] = include;
@@ -1495,8 +1498,9 @@ int select_question(int count)
 			size_t len = strtrim(response);
 			if(len > 0) {
 				int n;
-				if(parseindex(response, &n, 1, count) != 0)
+				if(parseindex(response, &n, 1, count) != 0) {
 					continue;
+				}
 				return (n - 1);
 			}
 		}
-- 
2.13.3


More information about the pacman-dev mailing list