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 <kerolasa@iki.fi>

[Allan] Keep comment
Signed-off-by: Allan McRae <allan@archlinux.org>

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Sami Kerola 2013-09-02 21:30:47 +01:00 committed by Allan McRae
parent a86015f73f
commit 8a72761743

View file

@ -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;
}