[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: test_get_chunked: do not allocate buffer for cls
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: test_get_chunked: do not allocate buffer for cls when not needed |
Date: |
Mon, 16 Aug 2021 10:29:09 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit dd2123098702285101d944d79f8bc668b1a2622c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Aug 16 11:25:27 2021 +0300
test_get_chunked: do not allocate buffer for cls when not needed
---
src/testcurl/test_get_chunked.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 19663b0c..7e29d342 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -180,7 +180,6 @@ ahc_echo (void *cls,
static int aptr;
const char *me = cls;
struct MHD_Response *response;
- struct MHD_Response **responseptr;
enum MHD_Result ret;
(void) url;
@@ -196,17 +195,20 @@ ahc_echo (void *cls,
*ptr = &aptr;
return MHD_YES;
}
- responseptr = malloc (sizeof (struct MHD_Response *));
- if (NULL == responseptr)
- _exit (99);
if (! resp_string)
{
+ struct MHD_Response **responseptr;
+ responseptr = malloc (sizeof (struct MHD_Response *));
+ if (NULL == responseptr)
+ _exit (99);
+
response = MHD_create_response_from_callback (resp_sized ?
RESP_SIZE : MHD_SIZE_UNKNOWN,
1024,
&crc,
responseptr,
&crcf);
+ *responseptr = response;
}
else
{
@@ -246,7 +248,6 @@ ahc_echo (void *cls,
abort ();
}
- *responseptr = response;
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
response);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.