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:
parent
a86015f73f
commit
8a72761743
1 changed files with 6 additions and 8 deletions
|
@ -190,15 +190,13 @@ int rmrf(const char *path)
|
||||||
if(!unlink(path)) {
|
if(!unlink(path)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
if(errno == ENOENT) {
|
switch(errno) {
|
||||||
|
case ENOENT:
|
||||||
return 0;
|
return 0;
|
||||||
} else if(errno == EPERM) {
|
case EPERM:
|
||||||
/* fallthrough */
|
case EISDIR:
|
||||||
} else if(errno == EISDIR) {
|
break;
|
||||||
/* fallthrough */
|
default:
|
||||||
} else if(errno == ENOTDIR) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
/* not a directory */
|
/* not a directory */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue