summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-02 17:15:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-05-02 17:15:55 (GMT)
commit7710d1be607a7c8549ddb560dda2dd97ff38ab7a (patch)
tree99aa46ec9597bc7292c1168ed2c04d4a9f3322cb /compat
parent6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e (diff)
parent72a4ea71e5f29e4078363e87e4471128ff713a62 (diff)
downloadgit-7710d1be607a7c8549ddb560dda2dd97ff38ab7a.zip
git-7710d1be607a7c8549ddb560dda2dd97ff38ab7a.tar.gz
git-7710d1be607a7c8549ddb560dda2dd97ff38ab7a.tar.bz2
Merge branch 'ep/maint-equals-null-cocci' into ep/equals-null-cocci
* ep/maint-equals-null-cocci: tree-wide: apply equals-null.cocci tree-wide: apply equals-null.cocci contrib/coccinnelle: add equals-null.cocci
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c6
-rw-r--r--compat/mkdir.c2
-rw-r--r--compat/mmap.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 6fe80fd..5772692 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1060,7 +1060,7 @@ char *mingw_mktemp(char *template)
int mkstemp(char *template)
{
char *filename = mktemp(template);
- if (filename == NULL)
+ if (!filename)
return -1;
return open(filename, O_RDWR | O_CREAT, 0600);
}
@@ -2332,7 +2332,7 @@ int setitimer(int type, struct itimerval *in, struct itimerval *out)
static const struct timeval zero;
static int atexit_done;
- if (out != NULL)
+ if (out)
return errno = EINVAL,
error("setitimer param 3 != NULL not implemented");
if (!is_timeval_eq(&in->it_interval, &zero) &&
@@ -2361,7 +2361,7 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)
if (sig != SIGALRM)
return errno = EINVAL,
error("sigaction only implemented for SIGALRM");
- if (out != NULL)
+ if (out)
return errno = EINVAL,
error("sigaction: param 3 != NULL not implemented");
diff --git a/compat/mkdir.c b/compat/mkdir.c
index 9e253fb..02aea3b 100644
--- a/compat/mkdir.c
+++ b/compat/mkdir.c
@@ -9,7 +9,7 @@ int compat_mkdir_wo_trailing_slash(const char *dir, mode_t mode)
size_t len = strlen(dir);
if (len && dir[len-1] == '/') {
- if ((tmp_dir = strdup(dir)) == NULL)
+ if (!(tmp_dir = strdup(dir)))
return -1;
tmp_dir[len-1] = '\0';
}
diff --git a/compat/mmap.c b/compat/mmap.c
index 8d6c02d..2fe1c77 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -13,7 +13,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
}
start = malloc(length);
- if (start == NULL) {
+ if (!start) {
errno = ENOMEM;
return MAP_FAILED;
}