coccinelle: polish FREE_AND_NULL rules
[gitweb.git] / apply.c
diff --git a/apply.c b/apply.c
index c49cef0637355d33a7a1636fb283210784f14e02..e78de0affa92beb8408304d4fe90684891017766 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -3705,8 +3705,7 @@ static int check_preimage(struct apply_state *state,
  is_new:
        patch->is_new = 1;
        patch->is_delete = 0;
-       free(patch->old_name);
-       patch->old_name = NULL;
+       FREE_AND_NULL(patch->old_name);
        return 0;
 }
 
@@ -3741,7 +3740,7 @@ static int check_to_create(struct apply_state *state,
                        return 0;
 
                return EXISTS_IN_WORKTREE;
-       } else if ((errno != ENOENT) && (errno != ENOTDIR)) {
+       } else if (!is_missing_file_error(errno)) {
                return error_errno("%s", new_name);
        }
        return 0;