gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 04/06: connection_alloc_memory_(): made function non-sta


From: gnunet
Subject: [libmicrohttpd] 04/06: connection_alloc_memory_(): made function non-static
Date: Sat, 28 May 2022 18:56:36 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 4a4d659bac5040c7f7538e28535b4baaa1529ba8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri May 20 13:09:59 2022 +0300

    connection_alloc_memory_(): made function non-static
---
 src/microhttpd/connection.c | 18 +++++++++---------
 src/microhttpd/connection.h | 14 ++++++++++++++
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index a260933c..f178f44e 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -242,9 +242,9 @@ str_conn_error_ (ssize_t mhd_err_code)
  * @return pointer to allocated memory region in the pool or
  *         NULL if no memory is available
  */
-static void *
-connection_alloc_memory (struct MHD_Connection *connection,
-                         size_t size)
+void *
+MHD_connection_alloc_memory_ (struct MHD_Connection *connection,
+                              size_t size)
 {
   struct MHD_Connection *const c = connection; /* a short alias */
   struct MemoryPool *const pool = c->pool;     /* a short alias */
@@ -482,8 +482,8 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection 
*connection,
 {
   struct MHD_HTTP_Req_Header *pos;
 
-  pos = connection_alloc_memory (connection,
-                                 sizeof (struct MHD_HTTP_Res_Header));
+  pos = MHD_connection_alloc_memory_ (connection,
+                                      sizeof (struct MHD_HTTP_Res_Header));
   if (NULL == pos)
     return MHD_NO;
   pos->header = key;
@@ -1033,8 +1033,8 @@ try_ready_normal_body (struct MHD_Connection *connection)
     if (NULL != connection->resp_iov.iov)
       return MHD_YES;
     copy_size = response->data_iovcnt * sizeof(MHD_iovec_);
-    connection->resp_iov.iov = connection_alloc_memory (connection,
-                                                        copy_size);
+    connection->resp_iov.iov = MHD_connection_alloc_memory_ (connection,
+                                                             copy_size);
     if (NULL == connection->resp_iov.iov)
     {
       MHD_mutex_unlock_chk_ (&response->mutex);
@@ -3103,8 +3103,8 @@ parse_cookie_header (struct MHD_Connection *connection)
   if (0 == hdr_len)
     return MHD_PARSE_COOKIE_OK;
 
-  cpy = connection_alloc_memory (connection,
-                                 hdr_len + 1);
+  cpy = MHD_connection_alloc_memory_ (connection,
+                                      hdr_len + 1);
   if (NULL == cpy)
     return MHD_PARSE_COOKIE_NO_MEMORY;
 
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 9f1a0ffb..693e26fc 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -190,4 +190,18 @@ MHD_connection_epoll_update_ (struct MHD_Connection 
*connection);
 void
 MHD_update_last_activity_ (struct MHD_Connection *connection);
 
+
+/**
+ * Allocate memory from connection's memory pool.
+ * If memory pool doesn't have enough free memory but read or write buffer
+ * have some unused memory, the size of the buffer will be reduced as needed.
+ * @param connection the connection to use
+ * @param size the size of allocated memory area
+ * @return pointer to allocated memory region in the pool or
+ *         NULL if no memory is available
+ */
+void *
+MHD_connection_alloc_memory_ (struct MHD_Connection *connection,
+                              size_t size);
+
 #endif

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]