From 8a72761743d746ed0a9b8b1201672e8ea0b8af4d Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 2 Sep 2013 21:30:47 +0100 Subject: pacman/util.c: use switch when there are fall through statements An 'if' clause with empty statement is allowed, but unusual construct. When 'if' is used this way the statement should at least have orphan semicolon ';'. For empty statements 'switch' feels like a native way express what is meant. Signed-off-by: Sami Kerola [Allan] Keep comment Signed-off-by: Allan McRae Signed-off-by: Allan McRae --- src/pacman/util.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/pacman/util.c b/src/pacman/util.c index 9eb0042e..6da1cd40 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -190,15 +190,13 @@ int rmrf(const char *path) if(!unlink(path)) { return 0; } else { - if(errno == ENOENT) { + switch(errno) { + case ENOENT: return 0; - } else if(errno == EPERM) { - /* fallthrough */ - } else if(errno == EISDIR) { - /* fallthrough */ - } else if(errno == ENOTDIR) { - return 1; - } else { + case EPERM: + case EISDIR: + break; + default: /* not a directory */ return 1; } -- cgit v1.2.3-70-g09d2