soup-message: deprecate soup_message_set_chunk_allocator()
authorDan Winship <danw@gnome.org>
Thu, 13 Dec 2012 14:58:28 +0000 (15:58 +0100)
committerDan Winship <danw@gnome.org>
Mon, 17 Dec 2012 21:09:50 +0000 (16:09 -0500)
This was added as a hacky way to avoid extra memcpy()s in certain use
cases by reading data directly into a caller-provided buffer. However,
SoupRequest now provides a vastly simpler way of doing this.

libsoup/soup-message.c
libsoup/soup-message.h
tests/chunk-test.c

index 2ce4a9b..ffcae72 100644 (file)
@@ -1597,6 +1597,9 @@ soup_message_set_status_full (SoupMessage *msg,
  * becomes possible to allocate a new buffer.
  *
  * Return value: the new buffer (or %NULL)
+ *
+ * Deprecated: Use #SoupRequest if you want to read into your
+ * own buffers.
  **/
 
 /**
@@ -1608,8 +1611,9 @@ soup_message_set_status_full (SoupMessage *msg,
  * destroyed
  *
  * Sets an alternate chunk-allocation function to use when reading
- * @msg's body. Every time data is available to read, libsoup will
- * call @allocator, which should return a #SoupBuffer. (See
+ * @msg's body when using the traditional (ie, non-#SoupRequest-based)
+ * API. Every time data is available to read, libsoup will call
+ * @allocator, which should return a #SoupBuffer. (See
  * #SoupChunkAllocator for additional details.) Libsoup will then read
  * data from the network into that buffer, and update the buffer's
  * <literal>length</literal> to indicate how much data it read.
@@ -1633,6 +1637,10 @@ soup_message_set_status_full (SoupMessage *msg,
  * you'll need to ref the #SoupBuffer (or its owner, in the
  * soup_buffer_new_with_owner() case) to ensure that the data remains
  * valid.
+ *
+ * Deprecated: #SoupRequest provides a much simpler API that lets you
+ * read the response directly into your own buffers without needing to
+ * mess with callbacks, pausing/unpausing, etc.
  **/
 void
 soup_message_set_chunk_allocator (SoupMessage *msg,
index 6692c38..f0fbeb3 100644 (file)
@@ -171,6 +171,7 @@ typedef SoupBuffer * (*SoupChunkAllocator)      (SoupMessage       *msg,
                                                 gsize              max_len,
                                                 gpointer           user_data);
 
+SOUP_DEPRECATED_IN_2_42_FOR(SoupRequest)
 void           soup_message_set_chunk_allocator (SoupMessage       *msg,
                                                 SoupChunkAllocator allocator,
                                                 gpointer           user_data,
index cce7127..ce92956 100644 (file)
@@ -284,7 +284,9 @@ do_response_test (SoupSession *session, SoupURI *base_uri)
 
        msg = soup_message_new_from_uri ("GET", base_uri);
        soup_message_body_set_accumulate (msg->response_body, FALSE);
+       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
        soup_message_set_chunk_allocator (msg, chunk_allocator, &gtd, NULL);
+       G_GNUC_END_IGNORE_DEPRECATIONS;
        g_signal_connect (msg, "got_chunk",
                          G_CALLBACK (got_chunk), &gtd);
        soup_session_send_message (session, msg);