[libsoup] soup-message: deprecate soup_message_set_chunk_allocator()



commit b4f85bccc9ea4b28c4fcb86da6fe44bb48d9bb52
Author: Dan Winship <danw gnome org>
Date:   Thu Dec 13 15:58:28 2012 +0100

    soup-message: deprecate soup_message_set_chunk_allocator()
    
    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 |   12 ++++++++++--
 libsoup/soup-message.h |    1 +
 tests/chunk-test.c     |    2 ++
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 2ce4a9b..ffcae72 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -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,
diff --git a/libsoup/soup-message.h b/libsoup/soup-message.h
index 6692c38..f0fbeb3 100644
--- a/libsoup/soup-message.h
+++ b/libsoup/soup-message.h
@@ -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,
diff --git a/tests/chunk-test.c b/tests/chunk-test.c
index cce7127..ce92956 100644
--- a/tests/chunk-test.c
+++ b/tests/chunk-test.c
@@ -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);



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