grep: adjust a redundant grep pattern type assignment
[gitweb.git] / diff-lib.c
index c82b07dc1eb47b439bd56f50fb4d07cc8218d22a..2a52b079546cb01d8dfe708f7e7c7e38ec582435 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
@@ -236,7 +235,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                old_oid = &ce->oid;
                new_oid = changed ? &null_oid : &ce->oid;
                diff_change(&revs->diffopt, oldmode, newmode,
-                           old_oid->hash, new_oid->hash,
+                           old_oid, new_oid,
                            !is_null_oid(old_oid),
                            !is_null_oid(new_oid),
                            ce->name, 0, dirty_submodule);
@@ -367,7 +366,7 @@ static int show_modified(struct rev_info *revs,
                return 0;
 
        diff_change(&revs->diffopt, oldmode, mode,
-                   old->oid.hash, oid->hash, 1, !is_null_oid(oid),
+                   &old->oid, oid, 1, !is_null_oid(oid),
                    old->name, 0, dirty_submodule);
        return 0;
 }
@@ -409,7 +408,7 @@ static void do_oneway_diff(struct unpack_trees_options *o,
                struct diff_filepair *pair;
                pair = diff_unmerge(&revs->diffopt, idx->name);
                if (tree)
-                       fill_filespec(pair->one, tree->oid.hash, 1,
+                       fill_filespec(pair->one, &tree->oid, 1,
                                      tree->ce_mode);
                return;
        }