coccinelle: make use of the "type" FREE_AND_NULL() rule
[gitweb.git] / diff-lib.c
index 2982bf055acb6049a8cd6007244d60d985b7e619..7528f4163f87f10628405e6e82e9facac7e0fc35 100644 (file)
@@ -29,7 +29,7 @@
 static int check_removed(const struct cache_entry *ce, struct stat *st)
 {
        if (lstat(ce->name, st) < 0) {
-               if (errno != ENOENT && errno != ENOTDIR)
+               if (!is_missing_file_error(errno))
                        return -1;
                return 1;
        }
@@ -179,8 +179,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                free(dpath);
                                continue;
                        }
-                       free(dpath);
-                       dpath = NULL;
+                       FREE_AND_NULL(dpath);
 
                        /*
                         * Show the diff for the 'ce' if we found the one