[collectd] [PATCH 2/2] Add missing return statements, unify pthread_exit usage.

Benjamin Jacobs jacobsbenja at gmail.com
Sun Sep 2 23:54:35 CEST 2012


Fix gcc warn/error: no return statement in function returning non-void [-Werror=return-type]
---
 src/amqp.c     |    3 ++-
 src/collectd.c |    4 ++--
 src/dns.c      |    4 ++--
 src/email.c    |    7 +++++--
 src/exec.c     |    4 ++--
 src/pinba.c    |    4 ++--
 src/plugin.c   |    2 +-
 7 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/amqp.c b/src/amqp.c
index 55d2a2c..bd30e1a 100644
--- a/src/amqp.c
+++ b/src/amqp.c
@@ -640,7 +640,8 @@ static void *camqp_subscribe_thread (void *user_data) /* {{{ */
     } /* while (subscriber_threads_running) */
 
     camqp_config_free (conf);
-    pthread_exit (NULL);
+    pthread_exit ((void *) 0);
+    return ((void *) 0);
 } /* }}} void *camqp_subscribe_thread */
 
 static int camqp_subscribe_init (camqp_config_t *conf) /* {{{ */
diff --git a/src/collectd.c b/src/collectd.c
index d33d1d6..03e28d2 100644
--- a/src/collectd.c
+++ b/src/collectd.c
@@ -55,8 +55,8 @@ static void *do_flush (void __attribute__((unused)) *arg)
 			/* timeout = */ 0,
 			/* ident = */ NULL);
 	INFO ("Finished flushing all data.");
-	pthread_exit (NULL);
-	return NULL;
+	pthread_exit ((void *) 0);
+	return ((void *) 0);
 }
 
 static void sig_int_handler (int __attribute__((unused)) signal)
diff --git a/src/dns.c b/src/dns.c
index 95797f5..a907613 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -268,9 +268,9 @@ static void *dns_child_loop (__attribute__((unused)) void *dummy)
 
 	pcap_close (pcap_obj);
 	listen_thread_init = 0;
-	pthread_exit (NULL);
+	pthread_exit ((void *) 0);
 
-	return (NULL);
+	return ((void *) 0);
 } /* static void dns_child_loop (void) */
 
 static int dns_init (void)
diff --git a/src/email.c b/src/email.c
index 8fc5509..70c6e79 100644
--- a/src/email.c
+++ b/src/email.c
@@ -375,7 +375,8 @@ static void *collect (void *arg)
 		pthread_cond_signal (&collector_available);
 	} /* while (1) */
 
-	pthread_exit ((void *)0);
+	pthread_exit ((void *) 0);
+	return ((void *) 0);
 } /* static void *collect (void *) */
 
 static void *open_connection (void __attribute__((unused)) *arg)
@@ -548,7 +549,9 @@ static void *open_connection (void __attribute__((unused)) *arg)
 
 		pthread_cond_signal (&conn_available);
 	}
-	pthread_exit ((void *)0);
+
+	pthread_exit ((void *) 0);
+	return ((void *) 0);
 } /* static void *open_connection (void *) */
 
 static int email_init (void)
diff --git a/src/exec.c b/src/exec.c
index c5ea155..88aa419 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -696,7 +696,7 @@ static void *exec_read_one (void *arg) /* {{{ */
     close (fd_err);
 
   pthread_exit ((void *) 0);
-  return (NULL);
+  return ((void *) 0);
 } /* void *exec_read_one }}} */
 
 static void *exec_notification_one (void *arg) /* {{{ */
@@ -782,7 +782,7 @@ static void *exec_notification_one (void *arg) /* {{{ */
   n->meta = NULL;
   sfree (arg);
   pthread_exit ((void *) 0);
-  return (NULL);
+  return ((void *) 0);
 } /* void *exec_notification_one }}} */
 
 static int exec_init (void) /* {{{ */
diff --git a/src/pinba.c b/src/pinba.c
index 26aa539..a512f03 100644
--- a/src/pinba.c
+++ b/src/pinba.c
@@ -551,8 +551,8 @@ static void *collector_thread (void *arg) /* {{{ */
 
   memset (&collector_thread_id, 0, sizeof (collector_thread_id));
   collector_thread_running = 0;
-  pthread_exit (NULL);
-  return (NULL);
+  pthread_exit ((void *) 0);
+  return ((void *) 0);
 } /* }}} void *collector_thread */
 
 /*
diff --git a/src/plugin.c b/src/plugin.c
index cdd56bd..39c4486 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -500,7 +500,7 @@ static void *plugin_read_thread (void __attribute__((unused)) *args)
 		c_heap_insert (read_heap, rf);
 	} /* while (read_loop) */
 
-	pthread_exit (NULL);
+	pthread_exit ((void *) 0);
 	return ((void *) 0);
 } /* void *plugin_read_thread */
 
-- 
1.7.10.4





More information about the collectd mailing list