Simplify the checks in ecore_con_url_http_post_send.
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 11 Oct 2010 19:12:26 +0000 (19:12 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 11 Oct 2010 19:12:26 +0000 (19:12 +0000)
By checking for the validity of the Ecore_Con_Url struct before anything
else and merging some if's, the code can get much cleaner.

By: Raphael Kubo da Costa <kubo@profusion.mobi>

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@53274 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_con/ecore_con_url.c

index 0f56b55..be64054 100644 (file)
@@ -935,11 +935,6 @@ EAPI Eina_Bool
 ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *httppost)
 {
 #ifdef HAVE_CURL
-   if (url_con->post)
-      curl_formfree(url_con->post);
-
-   url_con->post = NULL;
-
    if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
      {
         ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
@@ -947,13 +942,10 @@ ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *httppost)
         return EINA_FALSE;
      }
 
-   url_con->post = httppost;
-
-   if (url_con->active)
+   if ((url_con->active) || (!url_con->url))
       return EINA_FALSE;
 
-   if (!url_con->url)
-      return EINA_FALSE;
+   url_con->post = httppost;
 
    curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPPOST, httppost);