From 67819bc8a1aed5be9ecb86ee807895efb0f97cfc Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Wed, 15 Aug 2012 13:55:51 +0200
Subject: [PATCH 4/6] Use NULL instead of 0 where pointers are expected.

There are 6 remaining occurrences after this commit, in mod_compress,
due to zlib's Z_NULL being defined as 0 instead of NULL.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
---
 src/lemon.c          |    4 ++--
 src/lempar.c         |    6 +++---
 src/mod_cgi.c        |    2 +-
 src/mod_compress.c   |    4 ++--
 src/mod_extforward.c |    2 +-
 src/mod_proxy.c      |    2 +-
 src/mod_webdav.c     |    2 +-
 src/network_writev.c |    2 +-
 src/request.c        |    2 +-
 src/stream.c         |    2 +-
 10 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/lemon.c b/src/lemon.c
index 48df45f..1fd6a25 100644
--- a/src/lemon.c
+++ b/src/lemon.c
@@ -357,10 +357,10 @@ void Configtable_clear(/* int(*)(struct config *) */);
 
 /* Allocate a new parser action */
 struct action *Action_new(){
-  static struct action *freelist = 0;
+  static struct action *freelist = NULL;
   struct action *new;
 
-  if( freelist==0 ){
+  if( freelist==NULL ){
     int i;
     int amt = 100;
     freelist = (struct action *)malloc( sizeof(struct action)*amt );
diff --git a/src/lempar.c b/src/lempar.c
index 26708ea..ef9bd94 100644
--- a/src/lempar.c
+++ b/src/lempar.c
@@ -158,8 +158,8 @@ typedef struct yyParser yyParser;
 
 #ifndef NDEBUG
 #include <stdio.h>
-static FILE *yyTraceFILE = 0;
-static char *yyTracePrompt = 0;
+static FILE *yyTraceFILE = NULL;
+static char *yyTracePrompt = NULL;
 #endif /* NDEBUG */
 
 #ifndef NDEBUG
@@ -310,7 +310,7 @@ void ParseFree(
   void (*freeProc)(void*)     /* Function used to reclaim memory */
 ){
   yyParser *pParser = (yyParser*)p;
-  if( pParser==0 ) return;
+  if( pParser==NULL ) return;
   while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
   (*freeProc)((void*)pParser);
 }
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index d6f7528..5e65f4b 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -1099,7 +1099,7 @@ static int cgi_create_env(server *srv, connection *con, plugin_data *p, buffer *
 
 						c->file.mmap.length = c->file.length;
 
-						if (MAP_FAILED == (c->file.mmap.start = mmap(0,  c->file.mmap.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
+						if (MAP_FAILED == (c->file.mmap.start = mmap(NULL,  c->file.mmap.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
 							log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed: ",
 									strerror(errno), c->file.name,  c->file.fd);
 
diff --git a/src/mod_compress.c b/src/mod_compress.c
index 455e97e..10f7299 100644
--- a/src/mod_compress.c
+++ b/src/mod_compress.c
@@ -750,10 +750,10 @@ PHYSICALPATH_FUNC(mod_compress_physical) {
 	if (sce->st.st_size < 128) return HANDLER_GO_ON;
 
 	/* check if mimetype is in compress-config */
-	content_type = 0;
+	content_type = NULL;
 	if (sce->content_type->ptr) {
 		char *c;
-		if ( (c = strchr(sce->content_type->ptr, ';')) != 0) {
+		if ( (c = strchr(sce->content_type->ptr, ';')) != NULL) {
 			content_type = srv->tmp_buf;
 			buffer_copy_string_len(content_type, sce->content_type->ptr, c - sce->content_type->ptr);
 		}
diff --git a/src/mod_extforward.c b/src/mod_extforward.c
index d63bbb4..ba7c3c9 100644
--- a/src/mod_extforward.c
+++ b/src/mod_extforward.c
@@ -328,7 +328,7 @@ static struct addrinfo *ipstr_to_sockaddr(server *srv, const char *host) {
 			"could not resolve hostname ", host, " because ", gai_strerror(result), strerror(errno));
 
 		return NULL;
-	} else if (res0 == 0) {
+	} else if (res0 == NULL) {
 		log_error_write(srv, __FILE__, __LINE__, "SSS",
 			"Problem in resolving hostname ", host, ": succeeded, but no information returned");
 	}
diff --git a/src/mod_proxy.c b/src/mod_proxy.c
index abbc7fa..c6ee4e1 100644
--- a/src/mod_proxy.c
+++ b/src/mod_proxy.c
@@ -1211,7 +1211,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p
 				if (s_len > ct_len + 1) {
 					char *pi_offset;
 
-					if (0 != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) {
+					if (NULL != (pi_offset = strchr(fn->ptr + ct_len + 1, '/'))) {
 						path_info_offset = pi_offset - fn->ptr;
 					}
 				}
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index 100174d..2231ab8 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -1721,7 +1721,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) {
 						return HANDLER_ERROR;
 					}
 
-					if (MAP_FAILED == (c->file.mmap.start = mmap(0, c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
+					if (MAP_FAILED == (c->file.mmap.start = mmap(NULL, c->file.length, PROT_READ, MAP_SHARED, c->file.fd, 0))) {
 						log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed: ",
 								strerror(errno), c->file.name,  c->file.fd);
 						close(c->file.fd);
diff --git a/src/network_writev.c b/src/network_writev.c
index 65bb19d..d21cc4f 100644
--- a/src/network_writev.c
+++ b/src/network_writev.c
@@ -240,7 +240,7 @@ int network_write_chunkqueue_writev(server *srv, connection *con, int fd, chunkq
 #endif
 				}
 
-				if (MAP_FAILED == (c->file.mmap.start = mmap(0, to_mmap, PROT_READ, MAP_SHARED, c->file.fd, c->file.mmap.offset))) {
+				if (MAP_FAILED == (c->file.mmap.start = mmap(NULL, to_mmap, PROT_READ, MAP_SHARED, c->file.fd, c->file.mmap.offset))) {
 					/* close it here, otherwise we'd have to set FD_CLOEXEC */
 
 					log_error_write(srv, __FILE__, __LINE__, "ssbd", "mmap failed:",
diff --git a/src/request.c b/src/request.c
index e76a98f..de1a782 100644
--- a/src/request.c
+++ b/src/request.c
@@ -1022,7 +1022,7 @@ int http_request_parse(server *srv, connection *con) {
 					i++;
 					first = i+1;
 					is_key = 1;
-					value = 0;
+					value = NULL;
 #if 0
 					/**
 					 * for Bug 1230 keep the key_len a live
diff --git a/src/stream.c b/src/stream.c
index f91e73c..c29a5ca 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -34,7 +34,7 @@ int stream_open(stream *f, buffer *fn) {
 		return -1;
 	}
 
-	f->start = mmap(0, f->size, PROT_READ, MAP_SHARED, fd, 0);
+	f->start = mmap(NULL, f->size, PROT_READ, MAP_SHARED, fd, 0);
 
 	close(fd);
 
-- 
1.7.10.4

