nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2a497f1483239b111ce7cba7279f171aa7e02821
parent 763638654f6d62ebb129f1b60a2fbf9d409590f4
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Sun, 14 Jun 2020 12:41:47 +0200

use NULL instead of casting 0 to a pointer type

The conversion was done using:

  sed -r 's/\([^()]* \*\)[[:space:]]*0([,\)])/NULL\1/g' -i *.[ch]

Diffstat:
Mdns.c | 2+-
Mfmt.h | 4+++-
Mnow.c | 2+-
Mqmail-qmqpd.c | 2+-
Mqmail-qmtpd.c | 2+-
Mqmail-queue.c | 8++++----
Mqmail-remote.c | 2+-
Mqmail-send.c | 2+-
Mqmail-smtpd.c | 4++--
Msig_block.c | 7++++---
Msig_catch.c | 3++-
Mspawn.c | 2+-
Msplogger.c | 2+-
Mstrerr.h | 42+++++++++++++++++++++---------------------
Mtimeoutconn.c | 2+-
Mtimeoutread.c | 2+-
Mtimeoutwrite.c | 2+-
Mtrynpbg1.c | 3++-
Mtrysgact.c | 3++-
Mtrysgprm.c | 3++-
Mwait_nohang.c | 2+-
21 files changed, 54 insertions(+), 47 deletions(-)

diff --git a/dns.c b/dns.c @@ -209,7 +209,7 @@ int dns_ptr(stralloc *sa, struct ip_address *ipa) { int r; - if (!stralloc_ready(sa,iaafmt((char *) 0,ipa))) return DNS_MEM; + if (!stralloc_ready(sa,iaafmt(NULL,ipa))) return DNS_MEM; sa->len = iaafmt(sa->s,ipa); switch(resolve(sa,T_PTR)) { diff --git a/fmt.h b/fmt.h @@ -1,8 +1,10 @@ #ifndef FMT_H #define FMT_H +#include <stddef.h> + #define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */ -#define FMT_LEN ((char *) 0) /* convenient abbreviation */ +#define FMT_LEN (NULL) /* convenient abbreviation */ extern unsigned int fmt_uint(char *, unsigned int); extern unsigned int fmt_uint0(char *, unsigned int, unsigned int); diff --git a/now.c b/now.c @@ -4,5 +4,5 @@ datetime_sec now() { - return time((long *) 0); + return time(NULL); } diff --git a/qmail-qmqpd.c b/qmail-qmqpd.c @@ -80,7 +80,7 @@ void identify() if (!local) local = env_get("TCPLOCALIP"); if (!local) local = "unknown"; - received(&qq,"QMQP",local,remoteip,remotehost,remoteinfo,(char *) 0); + received(&qq,"QMQP",local,remoteip,remotehost,remoteinfo,NULL); } char buf[1000]; diff --git a/qmail-qmtpd.c b/qmail-qmtpd.c @@ -133,7 +133,7 @@ main() else if (ch == 13) flagdos = 1; else badproto(); - received(&qq,"QMTP",local,remoteip,remotehost,remoteinfo,(char *) 0); + received(&qq,"QMTP",local,remoteip,remotehost,remoteinfo,NULL); /* XXX: check for loops? only if len is big? */ diff --git a/qmail-queue.c b/qmail-queue.c @@ -97,7 +97,7 @@ char *s; void received_setup() { - receivedlen = receivedfmt((char *) 0); + receivedlen = receivedfmt(NULL); received = alloc(receivedlen + 1); if (!received) die(51); receivedfmt(received); @@ -128,7 +128,7 @@ int flagsplit; { char *s; - s = alloc(fmtqfn((char *) 0,dirslash,messnum,flagsplit)); + s = alloc(fmtqfn(NULL,dirslash,messnum,flagsplit)); if (!s) die(51); fmtqfn(s,dirslash,messnum,flagsplit); return s; @@ -140,13 +140,13 @@ void pidopen() unsigned long seq; seq = 1; - len = pidfmt((char *) 0,seq); + len = pidfmt(NULL,seq); pidfn = alloc(len); if (!pidfn) die(51); for (seq = 1;seq < 10;++seq) { - if (pidfmt((char *) 0,seq) > len) die(81); /* paranoia */ + if (pidfmt(NULL,seq) > len) die(81); /* paranoia */ pidfmt(pidfn,seq); messfd = open_excl(pidfn); if (messfd != -1) return; diff --git a/qmail-remote.c b/qmail-remote.c @@ -301,7 +301,7 @@ void getcontrols() if (control_readint(&timeout,"control/timeoutremote") == -1) temp_control(); if (control_readint(&timeoutconnect,"control/timeoutconnect") == -1) temp_control(); - if (control_rldef(&helohost,"control/helohost",1,(char *) 0) != 1) + if (control_rldef(&helohost,"control/helohost",1,NULL) != 1) temp_control(); switch(control_readfile(&routes,"control/smtproutes",0)) { case -1: diff --git a/qmail-send.c b/qmail-send.c @@ -1588,7 +1588,7 @@ int main(void) else tv.tv_sec = wakeup - recent + SLEEP_FUZZ; tv.tv_usec = 0; - if (select(nfds,&rfds,&wfds,(fd_set *) 0,&tv) == -1) + if (select(nfds,&rfds,&wfds,NULL,&tv) == -1) if (errno == error_intr) ; else diff --git a/qmail-smtpd.c b/qmail-smtpd.c @@ -103,9 +103,9 @@ void setup() unsigned long u; if (control_init() == -1) die_control(); - if (control_rldef(&greeting,"control/smtpgreeting",1,(char *) 0) != 1) + if (control_rldef(&greeting,"control/smtpgreeting",1,NULL) != 1) die_control(); - liphostok = control_rldef(&liphost,"control/localiphost",1,(char *) 0); + liphostok = control_rldef(&liphost,"control/localiphost",1,NULL); if (liphostok == -1) die_control(); if (control_readint(&timeout,"control/timeoutsmtpd") == -1) die_control(); if (timeout <= 0) timeout = 1; diff --git a/sig_block.c b/sig_block.c @@ -1,4 +1,5 @@ #include <signal.h> +#include <stddef.h> #include "sig.h" #include "hassgprm.h" @@ -9,7 +10,7 @@ int sig; sigset_t ss; sigemptyset(&ss); sigaddset(&ss,sig); - sigprocmask(SIG_BLOCK,&ss,(sigset_t *) 0); + sigprocmask(SIG_BLOCK,&ss,NULL); #else sigblock(1 << (sig - 1)); #endif @@ -22,7 +23,7 @@ int sig; sigset_t ss; sigemptyset(&ss); sigaddset(&ss,sig); - sigprocmask(SIG_UNBLOCK,&ss,(sigset_t *) 0); + sigprocmask(SIG_UNBLOCK,&ss,NULL); #else sigsetmask(sigsetmask(~0) & ~(1 << (sig - 1))); #endif @@ -33,7 +34,7 @@ void sig_blocknone() #ifdef HASSIGPROCMASK sigset_t ss; sigemptyset(&ss); - sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0); + sigprocmask(SIG_SETMASK,&ss,NULL); #else sigsetmask(0); #endif diff --git a/sig_catch.c b/sig_catch.c @@ -1,4 +1,5 @@ #include <signal.h> +#include <stddef.h> #include "sig.h" #include "hassgact.h" @@ -11,7 +12,7 @@ void (*f)(); sa.sa_handler = f; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); - sigaction(sig,&sa,(struct sigaction *) 0); + sigaction(sig,&sa,NULL); #else signal(sig,f); /* won't work under System V, even nowadays---dorks */ #endif diff --git a/spawn.c b/spawn.c @@ -219,7 +219,7 @@ int main(int argc, char **argv) for (i = 0;i < auto_spawn;++i) if (d[i].used) { FD_SET(d[i].fdin,&rfds); if (d[i].fdin >= nfds) nfds = d[i].fdin + 1; } - r = select(nfds,&rfds,(fd_set *) 0,(fd_set *) 0,(struct timeval *) 0); + r = select(nfds,&rfds,NULL,NULL,NULL); sig_childblock(); if (r != -1) diff --git a/splogger.c b/splogger.c @@ -19,7 +19,7 @@ void stamp_make() { struct timeval tv; char *s; - gettimeofday(&tv,(struct timezone *) 0); + gettimeofday(&tv,NULL); s = stamp; s += fmt_ulong(s,(unsigned long) tv.tv_sec); *s++ = '.'; diff --git a/strerr.h b/strerr.h @@ -28,53 +28,53 @@ extern void strerr_die(); #define strerr_warn6(x1,x2,x3,x4,x5,x6,se) \ strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) (se)) #define strerr_warn5(x1,x2,x3,x4,x5,se) \ -strerr_warn((x1),(x2),(x3),(x4),(x5),(char *) 0,(struct strerr *) (se)) +strerr_warn((x1),(x2),(x3),(x4),(x5),NULL,(struct strerr *) (se)) #define strerr_warn4(x1,x2,x3,x4,se) \ -strerr_warn((x1),(x2),(x3),(x4),(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_warn((x1),(x2),(x3),(x4),NULL,NULL,(struct strerr *) (se)) #define strerr_warn3(x1,x2,x3,se) \ -strerr_warn((x1),(x2),(x3),(char *) 0,(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_warn((x1),(x2),(x3),NULL,NULL,NULL,(struct strerr *) (se)) #define strerr_warn2(x1,x2,se) \ -strerr_warn((x1),(x2),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_warn((x1),(x2),NULL,NULL,NULL,NULL,(struct strerr *) (se)) #define strerr_warn1(x1,se) \ -strerr_warn((x1),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_warn((x1),NULL,NULL,NULL,NULL,NULL,(struct strerr *) (se)) #define strerr_die6(e,x1,x2,x3,x4,x5,x6,se) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) (se)) #define strerr_die5(e,x1,x2,x3,x4,x5,se) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(char *) 0,(struct strerr *) (se)) +strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,(struct strerr *) (se)) #define strerr_die4(e,x1,x2,x3,x4,se) \ -strerr_die((e),(x1),(x2),(x3),(x4),(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,(struct strerr *) (se)) #define strerr_die3(e,x1,x2,x3,se) \ -strerr_die((e),(x1),(x2),(x3),(char *) 0,(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,(struct strerr *) (se)) #define strerr_die2(e,x1,x2,se) \ -strerr_die((e),(x1),(x2),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,(struct strerr *) (se)) #define strerr_die1(e,x1,se) \ -strerr_die((e),(x1),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(char *) 0,(struct strerr *) (se)) +strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,(struct strerr *) (se)) #define strerr_die6sys(e,x1,x2,x3,x4,x5,x6) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys) #define strerr_die5sys(e,x1,x2,x3,x4,x5) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(char *) 0,&strerr_sys) +strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,&strerr_sys) #define strerr_die4sys(e,x1,x2,x3,x4) \ -strerr_die((e),(x1),(x2),(x3),(x4),(char *) 0,(char *) 0,&strerr_sys) +strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,&strerr_sys) #define strerr_die3sys(e,x1,x2,x3) \ -strerr_die((e),(x1),(x2),(x3),(char *) 0,(char *) 0,(char *) 0,&strerr_sys) +strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,&strerr_sys) #define strerr_die2sys(e,x1,x2) \ -strerr_die((e),(x1),(x2),(char *) 0,(char *) 0,(char *) 0,(char *) 0,&strerr_sys) +strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,&strerr_sys) #define strerr_die1sys(e,x1) \ -strerr_die((e),(x1),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(char *) 0,&strerr_sys) +strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,&strerr_sys) #define strerr_die6x(e,x1,x2,x3,x4,x5,x6) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(struct strerr *) 0) +strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),NULL) #define strerr_die5x(e,x1,x2,x3,x4,x5) \ -strerr_die((e),(x1),(x2),(x3),(x4),(x5),(char *) 0,(struct strerr *) 0) +strerr_die((e),(x1),(x2),(x3),(x4),(x5),NULL,NULL) #define strerr_die4x(e,x1,x2,x3,x4) \ -strerr_die((e),(x1),(x2),(x3),(x4),(char *) 0,(char *) 0,(struct strerr *) 0) +strerr_die((e),(x1),(x2),(x3),(x4),NULL,NULL,NULL) #define strerr_die3x(e,x1,x2,x3) \ -strerr_die((e),(x1),(x2),(x3),(char *) 0,(char *) 0,(char *) 0,(struct strerr *) 0) +strerr_die((e),(x1),(x2),(x3),NULL,NULL,NULL,NULL) #define strerr_die2x(e,x1,x2) \ -strerr_die((e),(x1),(x2),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(struct strerr *) 0) +strerr_die((e),(x1),(x2),NULL,NULL,NULL,NULL,NULL) #define strerr_die1x(e,x1) \ -strerr_die((e),(x1),(char *) 0,(char *) 0,(char *) 0,(char *) 0,(char *) 0,(struct strerr *) 0) +strerr_die((e),(x1),NULL,NULL,NULL,NULL,NULL,NULL) #endif diff --git a/timeoutconn.c b/timeoutconn.c @@ -42,7 +42,7 @@ int timeout; FD_SET(s,&wfds); tv.tv_sec = timeout; tv.tv_usec = 0; - if (select(s + 1,(fd_set *) 0,&wfds,(fd_set *) 0,&tv) == -1) return -1; + if (select(s + 1,NULL,&wfds,NULL,&tv) == -1) return -1; if (FD_ISSET(s,&wfds)) { int dummy; dummy = sizeof(sin); diff --git a/timeoutread.c b/timeoutread.c @@ -14,7 +14,7 @@ int timeoutread(t,fd,buf,len) int t; int fd; char *buf; int len; FD_ZERO(&rfds); FD_SET(fd,&rfds); - if (select(fd + 1,&rfds,(fd_set *) 0,(fd_set *) 0,&tv) == -1) return -1; + if (select(fd + 1,&rfds,NULL,NULL,&tv) == -1) return -1; if (FD_ISSET(fd,&rfds)) return read(fd,buf,len); errno = error_timeout; diff --git a/timeoutwrite.c b/timeoutwrite.c @@ -14,7 +14,7 @@ int timeoutwrite(t,fd,buf,len) int t; int fd; char *buf; int len; FD_ZERO(&wfds); FD_SET(fd,&wfds); - if (select(fd + 1,(fd_set *) 0,&wfds,(fd_set *) 0,&tv) == -1) return -1; + if (select(fd + 1,NULL,&wfds,NULL,&tv) == -1) return -1; if (FD_ISSET(fd,&wfds)) return write(fd,buf,len); errno = error_timeout; diff --git a/trynpbg1.c b/trynpbg1.c @@ -1,3 +1,4 @@ +#include <stddef.h> #include "select.h" #include "open.h" #include "fifo.h" @@ -17,7 +18,7 @@ int main(void) FD_ZERO(&rfds); FD_SET(0,&rfds); instant.tv_sec = instant.tv_usec = 0; - if (select(1,&rfds,(fd_set *) 0,(fd_set *) 0,&instant) > 0) + if (select(1,&rfds,NULL,NULL,&instant) > 0) flagbug = 1; } unlink(FN); diff --git a/trysgact.c b/trysgact.c @@ -1,4 +1,5 @@ #include <signal.h> +#include <stddef.h> int main(void) { @@ -6,6 +7,6 @@ int main(void) sa.sa_handler = 0; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); - sigaction(0,&sa,(struct sigaction *) 0); + sigaction(0,&sa,NULL); return 0; } diff --git a/trysgprm.c b/trysgprm.c @@ -1,4 +1,5 @@ #include <signal.h> +#include <stddef.h> int main(void) { @@ -6,6 +7,6 @@ int main(void) sigemptyset(&ss); sigaddset(&ss,SIGCHLD); - sigprocmask(SIG_SETMASK,&ss,(sigset_t *) 0); + sigprocmask(SIG_SETMASK,&ss,NULL); return 0; } diff --git a/wait_nohang.c b/wait_nohang.c @@ -7,6 +7,6 @@ int wait_nohang(wstat) int *wstat; #ifdef HASWAITPID return waitpid(-1,wstat,WNOHANG); #else - return wait3(wstat,WNOHANG,(struct rusage *) 0); + return wait3(wstat,WNOHANG,NULL); #endif }