diff options
author | Dan Winship <danw@gnome.org> | 2012-12-13 15:58:28 +0100 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-12-17 16:09:50 -0500 |
commit | b4f85bccc9ea4b28c4fcb86da6fe44bb48d9bb52 (patch) | |
tree | 66c18c47c7d9f35ec10e2cb5f291e1b5dd11d0c6 | |
parent | 81df4008fe06b7ccb0ddee69d190608a13aa4020 (diff) | |
download | libsoup-b4f85bccc9ea4b28c4fcb86da6fe44bb48d9bb52.tar.gz |
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.
-rw-r--r-- | libsoup/soup-message.c | 12 | ||||
-rw-r--r-- | libsoup/soup-message.h | 1 | ||||
-rw-r--r-- | 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 2ce4a9b2..ffcae72b 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 6692c38d..f0fbeb37 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 cce7127f..ce929565 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, >d, NULL); + G_GNUC_END_IGNORE_DEPRECATIONS; g_signal_connect (msg, "got_chunk", G_CALLBACK (got_chunk), >d); soup_session_send_message (session, msg); |