diff mbox series

[11/23] builtin/gc.c: Fix coding style

Message ID 20220430041406.164719-12-gitter.spiros@gmail.com (mailing list archive)
State New, archived
Headers show
Series add a new coccinelle semantic patch to enforce a | expand

Commit Message

Elia Pinto April 30, 2022, 4:13 a.m. UTC
Adhere to the git coding style which requires "Do not explicitly compute an
integral value with constant 0 or '\ 0', or a pointer value with constant NULL."

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 builtin/gc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/builtin/gc.c b/builtin/gc.c
index b335cffa33..daa4535f1c 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -446,7 +446,7 @@  static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
 			fscanf(fp, scan_fmt, &pid, locking_host) == 2 &&
 			/* be gentle to concurrent "gc" on remote hosts */
 			(strcmp(locking_host, my_host) || !kill(pid, 0) || errno == EPERM);
-		if (fp != NULL)
+		if (fp)
 			fclose(fp);
 		if (should_exit) {
 			if (fd >= 0)
@@ -2238,7 +2238,7 @@  static int systemd_timer_write_unit_templates(const char *exec_path)
 		goto error;
 	}
 	file = fopen_or_warn(filename, "w");
-	if (file == NULL)
+	if (!file)
 		goto error;
 
 	unit = "# This file was created and is maintained by Git.\n"
@@ -2267,7 +2267,7 @@  static int systemd_timer_write_unit_templates(const char *exec_path)
 
 	filename = xdg_config_home_systemd("git-maintenance@.service");
 	file = fopen_or_warn(filename, "w");
-	if (file == NULL)
+	if (!file)
 		goto error;
 
 	unit = "# This file was created and is maintained by Git.\n"