apache plugin: Do not initialize the plugin if no URL has been specified.
authorSebastian Harl <sh@tokkee.org>
Tue, 22 Jan 2008 08:34:03 +0000 (09:34 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 22 Jan 2008 09:46:18 +0000 (10:46 +0100)
There is no need to initialize curl, if the plugin will not be used anyway.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/apache.c

index 2365d1f..5a3272f 100644 (file)
@@ -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)
        {