diff options
author | Mark Murray <markm@FreeBSD.org> | 2004-03-05 08:10:19 +0000 |
---|---|---|
committer | Mark Murray <markm@FreeBSD.org> | 2004-03-05 08:10:19 +0000 |
commit | 16fc3635f7aec3852abfc6dd77f89baef91f22fa (patch) | |
tree | 524ae0ef30bcdfacb05b3c2b01e1c48e80d93e3b /lib | |
parent | 5af2e7de06321c8f6aaa876fa79bf08870e8911c (diff) | |
download | src-16fc3635f7aec3852abfc6dd77f89baef91f22fa.tar.gz src-16fc3635f7aec3852abfc6dd77f89baef91f22fa.zip |
Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).
There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.
Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".
Tested on: i386 sparc64
Notes
Notes:
svn path=/head/; revision=126643
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libbluetooth/bluetooth.c | 2 | ||||
-rw-r--r-- | lib/libbsnmp/Makefile.inc | 1 | ||||
-rw-r--r-- | lib/libc/gen/dlfcn.c | 2 | ||||
-rw-r--r-- | lib/libc/gen/getpwent.c | 2 | ||||
-rw-r--r-- | lib/libc/net/gethostbydns.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/getnetconfig.c | 8 | ||||
-rw-r--r-- | lib/libpam/modules/pam_login_access/login_access.c | 2 | ||||
-rw-r--r-- | lib/libthr/arch/i386/i386/_setcurthread.c | 2 |
8 files changed, 12 insertions, 11 deletions
diff --git a/lib/libbluetooth/bluetooth.c b/lib/libbluetooth/bluetooth.c index 4678509541fb..f206aeeee4d8 100644 --- a/lib/libbluetooth/bluetooth.c +++ b/lib/libbluetooth/bluetooth.c @@ -291,7 +291,7 @@ bt_aton(char const *str, bdaddr_t *ba) memset(ba, 0, sizeof(*ba)); for (i = 5, end = strchr(str, ':'); - i > 0 && *str != NULL && end != NULL; + i > 0 && *str != '\0' && end != NULL; i --, str = end + 1, end = strchr(str, ':')) { switch (end - str) { case 1: diff --git a/lib/libbsnmp/Makefile.inc b/lib/libbsnmp/Makefile.inc index 130988db9921..554fc9378e49 100644 --- a/lib/libbsnmp/Makefile.inc +++ b/lib/libbsnmp/Makefile.inc @@ -2,4 +2,5 @@ SHLIB_MAJOR= 1 WARNS?= 6 +NO_WERROR= yes INCSDIR= ${INCLUDEDIR}/bsnmp diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 25aa94509b1d..be58e28c5cdd 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -109,7 +109,7 @@ int dlinfo(void * __restrict handle, int request, void * __restrict p) { _rtld_error(sorry); - return NULL; + return 0; } #pragma weak _rtld_thread_init diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index ed65ad8aeed9..d0e4bf3fb025 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -1624,7 +1624,7 @@ docompat: case '@': setnetgrent(&pw_name[2]); while (getnetgrent(&host, &user, &domain) != - NULL) { + 0) { if (user != NULL && user[0] != '\0') compat_exclude(user, &st->exclude); diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c index 82f515214caf..534073a80e9d 100644 --- a/lib/libc/net/gethostbydns.c +++ b/lib/libc/net/gethostbydns.c @@ -591,11 +591,11 @@ _dns_gethostbyname(void *rval, void *cb_data, va_list ap) if (n < 0) { free(buf); dprintf("res_search failed (%d)\n", n); - return (NULL); + return (0); } else if (n > sizeof(buf->buf)) { free(buf); dprintf("static buffer is too small (%d)\n", n); - return (NULL); + return (0); } *(struct hostent **)rval = gethostanswer(buf, n, name, type); free(buf); diff --git a/lib/libc/rpc/getnetconfig.c b/lib/libc/rpc/getnetconfig.c index dae03b81f403..ea140d437bf9 100644 --- a/lib/libc/rpc/getnetconfig.c +++ b/lib/libc/rpc/getnetconfig.c @@ -684,11 +684,11 @@ struct netconfig *ncp; */ *p = *ncp; p->nc_netid = (char *)strcpy(tmp,ncp->nc_netid); - tmp = strchr(tmp, NULL) + 1; + tmp = strchr(tmp, '\0') + 1; p->nc_protofmly = (char *)strcpy(tmp,ncp->nc_protofmly); - tmp = strchr(tmp, NULL) + 1; + tmp = strchr(tmp, '\0') + 1; p->nc_proto = (char *)strcpy(tmp,ncp->nc_proto); - tmp = strchr(tmp, NULL) + 1; + tmp = strchr(tmp, '\0') + 1; p->nc_device = (char *)strcpy(tmp,ncp->nc_device); p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *)); if (p->nc_lookups == NULL) { @@ -696,7 +696,7 @@ struct netconfig *ncp; return(NULL); } for (i=0; i < p->nc_nlookups; i++) { - tmp = strchr(tmp, NULL) + 1; + tmp = strchr(tmp, '\0') + 1; p->nc_lookups[i] = (char *)strcpy(tmp,ncp->nc_lookups[i]); } return(p); diff --git a/lib/libpam/modules/pam_login_access/login_access.c b/lib/libpam/modules/pam_login_access/login_access.c index 90089d8edc07..dbc139717dc5 100644 --- a/lib/libpam/modules/pam_login_access/login_access.c +++ b/lib/libpam/modules/pam_login_access/login_access.c @@ -126,7 +126,7 @@ list_match(char *list, const char *item, for (tok = strtok(list, sep); tok != 0; tok = strtok((char *) 0, sep)) { if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */ break; - if ((match = (*match_fn)(tok, item)) != NULL) /* YES */ + if ((match = (*match_fn)(tok, item)) != 0) /* YES */ break; } /* Process exceptions to matches. */ diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c index b0848805f566..4dd0d03e0498 100644 --- a/lib/libthr/arch/i386/i386/_setcurthread.c +++ b/lib/libthr/arch/i386/i386/_setcurthread.c @@ -102,7 +102,7 @@ _set_curthread(ucontext_t *uc, struct pthread *thr, int *err) if (thr != _thread_initial) _SPINLOCK(&ldt_lock); - if (ldt_inited == NULL) + if (ldt_inited == 0) ldt_init(); if (ldt_free == NULL) { |