diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-10 19:33:58 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-10 19:33:58 +0000 |
commit | 513004a23dac3416f8f9c11aaa148bf8606c8617 (patch) | |
tree | 6796a0cd32cea8fd5591b7f2c6d10ae7f153ccb9 /lib/libc/rpc | |
parent | 6e5bbb486cf872ff289d4573cb9d08bf3178b160 (diff) | |
download | src-513004a23dac3416f8f9c11aaa148bf8606c8617.tar.gz src-513004a23dac3416f8f9c11aaa148bf8606c8617.zip |
libc: replace 0 with NULL for pointers.
While here also cleanup some surrounding code; particularly
drop some malloc() casts.
Found with devel/coccinelle.
Reviewed by: bde (previous version - all new bugs are mine)
Notes
Notes:
svn path=/head/; revision=297790
Diffstat (limited to 'lib/libc/rpc')
-rw-r--r-- | lib/libc/rpc/auth_none.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_perror.c | 8 | ||||
-rw-r--r-- | lib/libc/rpc/mt_misc.c | 2 | ||||
-rw-r--r-- | lib/libc/rpc/rpcdname.c | 10 |
4 files changed, 13 insertions, 13 deletions
diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c index 0b846ebc9b18..32bebebf339d 100644 --- a/lib/libc/rpc/auth_none.c +++ b/lib/libc/rpc/auth_none.c @@ -83,9 +83,9 @@ authnone_create(void) XDR *xdrs; mutex_lock(&authnone_lock); - if (ap == 0) { - ap = (struct authnone_private *)calloc(1, sizeof (*ap)); - if (ap == 0) { + if (ap == NULL) { + ap = calloc(1, sizeof (*ap)); + if (ap == NULL) { mutex_unlock(&authnone_lock); return (0); } diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c index 15d72803df71..d674fbb3847f 100644 --- a/lib/libc/rpc/clnt_perror.c +++ b/lib/libc/rpc/clnt_perror.c @@ -64,8 +64,8 @@ static char * _buf(void) { - if (buf == 0) - buf = (char *)malloc(CLNT_PERROR_BUFLEN); + if (buf == NULL) + buf = malloc(CLNT_PERROR_BUFLEN); return (buf); } @@ -85,7 +85,7 @@ clnt_sperror(CLIENT *rpch, const char *s) assert(s != NULL); str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */ - if (str == 0) + if (str == NULL) return (0); len = CLNT_PERROR_BUFLEN; strstart = str; @@ -240,7 +240,7 @@ clnt_spcreateerror(const char *s) assert(s != NULL); str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */ - if (str == 0) + if (str == NULL) return(0); len = CLNT_PERROR_BUFLEN; i = snprintf(str, len, "%s: ", s); diff --git a/lib/libc/rpc/mt_misc.c b/lib/libc/rpc/mt_misc.c index 0ec4d8a8b79d..a1b8057bef80 100644 --- a/lib/libc/rpc/mt_misc.c +++ b/lib/libc/rpc/mt_misc.c @@ -95,7 +95,7 @@ rce_key_init(void) struct rpc_createerr * __rpc_createerr(void) { - struct rpc_createerr *rce_addr = 0; + struct rpc_createerr *rce_addr = NULL; if (thr_main()) return (&rpc_createerr); diff --git a/lib/libc/rpc/rpcdname.c b/lib/libc/rpc/rpcdname.c index f214b2122d5d..08b5d7d49fc5 100644 --- a/lib/libc/rpc/rpcdname.c +++ b/lib/libc/rpc/rpcdname.c @@ -43,20 +43,20 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include "un-namespace.h" -static char *default_domain = 0; +static char *default_domain; static char * get_default_domain(void) { char temp[256]; - if (default_domain) + if (default_domain != NULL) return (default_domain); if (getdomainname(temp, sizeof(temp)) < 0) return (0); if ((int) strlen(temp) > 0) { - default_domain = (char *)malloc((strlen(temp)+(unsigned)1)); - if (default_domain == 0) + default_domain = malloc((strlen(temp) + (unsigned)1)); + if (default_domain == NULL) return (0); (void) strcpy(default_domain, temp); return (default_domain); @@ -73,7 +73,7 @@ get_default_domain(void) int __rpc_get_default_domain(char **domain) { - if ((*domain = get_default_domain()) != 0) + if ((*domain = get_default_domain()) != NULL) return (0); return (-1); } |