From: Dan Winship Date: Sat, 23 Jan 2010 21:05:07 +0000 (-0500) Subject: soup-form.c: change some code to make clang happy and to be more obvious X-Git-Tag: LIBSOUP_2_29_6~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a65f7b08956a2825b96df8da57ebb64a7925a159;p=platform%2Fupstream%2Flibsoup.git 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 --- 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;