diff options
author | ngie <ngie@FreeBSD.org> | 2016-12-03 17:17:42 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-12-03 17:17:42 +0000 |
commit | de9c1e498c9083787fed20b89b77dce7f67d668e (patch) | |
tree | 4090ad0dc9bdc4f6d8760d071cac4a3cb7f3b346 /lib/libc/rpc | |
parent | bf027d30f65946c403cff801d75f469e39fa3e48 (diff) | |
download | FreeBSD-src-de9c1e498c9083787fed20b89b77dce7f67d668e.zip FreeBSD-src-de9c1e498c9083787fed20b89b77dce7f67d668e.tar.gz |
MFC r297790:
r297790 (by pfg):
libc: replace 0 with NULL for pointers.
While here also cleanup some surrounding code; particularly
drop some malloc() casts.
Found with devel/coccinelle.
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 0b846eb..32bebeb 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 5d87b0c..2fe7c15 100644 --- a/lib/libc/rpc/clnt_perror.c +++ b/lib/libc/rpc/clnt_perror.c @@ -64,8 +64,8 @@ static char * _buf() { - if (buf == 0) - buf = (char *)malloc(CLNT_PERROR_BUFLEN); + if (buf == NULL) + buf = malloc(CLNT_PERROR_BUFLEN); return (buf); } @@ -87,7 +87,7 @@ clnt_sperror(rpch, 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; @@ -247,7 +247,7 @@ clnt_spcreateerror(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 54712b0..0f5c1d2 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() { - 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 64a1242..3a37ccf 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); @@ -74,7 +74,7 @@ int __rpc_get_default_domain(domain) char **domain; { - if ((*domain = get_default_domain()) != 0) + if ((*domain = get_default_domain()) != NULL) return (0); return (-1); } |