[pacman-dev] [PATCH] simplify check for leading "local/"

Andrew Gregory andrew.gregory.8 at gmail.com
Mon Mar 3 18:29:09 EST 2014


Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/remove.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 00bd3b3..933e6f7 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -94,13 +94,10 @@ int pacman_remove(alpm_list_t *targets)
 	/* Step 1: add targets to the created transaction */
 	for(i = targets; i; i = alpm_list_next(i)) {
 		char *target = i->data;
-		char *targ = strchr(target, '/');
-		if(targ && strncmp(target, "local", 5) == 0) {
-			targ++;
-		} else {
-			targ = target;
+		if(strncmp(target, "local/", 6) == 0) {
+			target += 6;
 		}
-		if(remove_target(targ) == -1) {
+		if(remove_target(target) == -1) {
 			retval = 1;
 		}
 	}
-- 
1.9.0



More information about the pacman-dev mailing list