[collectd] [PATCH] apache.c: Do not initialize the plugin if no URL has been specified.

Sebastian Harl sh at tokkee.org
Tue Jan 22 09:34:03 CET 2008


There is no need to initialize curl, if the plugin will not be used anyway.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/apache.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/apache.c b/src/apache.c
index 2365d1f..5a3272f 100644
--- a/src/apache.c
+++ b/src/apache.c
@@ -102,6 +102,9 @@ static int init (void)
 {
 	static char credentials[1024];
 
+	if (url == NULL)
+		return (0);
+
 	if (curl != NULL)
 	{
 		curl_easy_cleanup (curl);
@@ -128,10 +131,7 @@ static int init (void)
 		curl_easy_setopt (curl, CURLOPT_USERPWD, credentials);
 	}
 
-	if (url != NULL)
-	{
-		curl_easy_setopt (curl, CURLOPT_URL, url);
-	}
+	curl_easy_setopt (curl, CURLOPT_URL, url);
 
 	if (cacert != NULL)
 	{
-- 
1.5.4.rc0.56.g6fbe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080122/ce5402d8/attachment.pgp 


More information about the collectd mailing list