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 <[email protected]>
---
 src/pacman/util.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index 9eb0042..6035963 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -190,16 +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 {
-                       /* not a directory */
+               case EPERM:
+               case EISDIR:
+                       break;
+               default:
                        return 1;
                }
 
-- 
1.8.4


Reply via email to