run-command: add hint when a hook is ignored
[gitweb.git] / diff-lib.c
index 9e076a48861a9be8f8fe9d17e6fa18197fc49fe1..4e0980caa80fb980938f68c8d350ec00cc24398b 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
@@ -550,7 +549,6 @@ int index_differs_from(const char *def, int diff_flags,
        rev.diffopt.flags |= diff_flags;
        rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
        run_diff_index(&rev, 1);
-       if (rev.pending.alloc)
-               free(rev.pending.objects);
+       object_array_clear(&rev.pending);
        return (DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES) != 0);
 }