[libsoup] soup-form.c: change some code to make clang happy and to be more obvious



commit a65f7b08956a2825b96df8da57ebb64a7925a159
Author: Dan Winship <danw gnome org>
Date:   Sat Jan 23 16:05:07 2010 -0500

    soup-form.c: change some code to make clang happy and to be more obvious
    
    based on a suggestion from kov in
    https://bugzilla.gnome.org/show_bug.cgi?id=605543

 libsoup/soup-form.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c
index 7263890..278d845 100644
--- a/libsoup/soup-form.c
+++ b/libsoup/soup-form.c
@@ -361,22 +361,21 @@ soup_form_request_for_data (const char *method, const char *uri_string,
 	if (!strcmp (method, "GET")) {
 		g_free (uri->query);
 		uri->query = form_data;
-		form_data = NULL;
-	}
 
-	msg = soup_message_new_from_uri (method, uri);
+		msg = soup_message_new_from_uri (method, uri);
+	} else if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
+		msg = soup_message_new_from_uri (method, uri);
 
-	if (!strcmp (method, "POST") || !strcmp (method, "PUT")) {
 		soup_message_set_request (
 			msg, SOUP_FORM_MIME_TYPE_URLENCODED,
 			SOUP_MEMORY_TAKE,
 			form_data, strlen (form_data));
-		form_data = NULL;
-	}
-
-	if (form_data) {
+	} else {
 		g_warning ("invalid method passed to soup_form_request_new");
 		g_free (form_data);
+
+		/* Don't crash */
+		msg = soup_message_new_from_uri (method, uri);
 	}
 
 	return msg;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]