[libsoup] io-http2: do not heap allocate nghttp2_data_provider
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] io-http2: do not heap allocate nghttp2_data_provider
- Date: Thu, 27 May 2021 11:09:26 +0000 (UTC)
commit 8251fbee4a1765feb9c04ba2fe1e47389f264f28
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Thu May 27 12:12:40 2021 +0200
io-http2: do not heap allocate nghttp2_data_provider
libsoup/http2/soup-client-message-io-http2.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 4916ed4b..812f6a67 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -912,14 +912,13 @@ send_message_request (SoupMessage *msg,
if (logger && body_stream)
data->logger = SOUP_LOGGER (logger);
- nghttp2_data_provider *data_provider = NULL;
+ nghttp2_data_provider data_provider;
if (body_stream) {
- data_provider = g_new (nghttp2_data_provider, 1);
- data_provider->source.ptr = body_stream;
- data_provider->read_callback = on_data_source_read_callback;
+ data_provider.source.ptr = body_stream;
+ data_provider.read_callback = on_data_source_read_callback;
}
- data->stream_id = nghttp2_submit_request (io->session, NULL, (const nghttp2_nv *)headers->data,
headers->len, data_provider, data);
+ data->stream_id = nghttp2_submit_request (io->session, NULL, (const nghttp2_nv *)headers->data,
headers->len, body_stream ? &data_provider : NULL, data);
h2_debug (io, data, "[SESSION] Request made for %s%s", authority_header, path_and_query);
@@ -927,7 +926,6 @@ send_message_request (SoupMessage *msg,
g_free (authority);
g_free (host);
g_free (path_and_query);
- g_free (data_provider);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]