GNU libmicrohttpd  1.0.1
memorypool.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2007--2024 Daniel Pittman and Christian Grothoff
4  Copyright (C) 2016--2024 Evgeny Grin (Karlson2k)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
30 #ifndef MEMORYPOOL_H
31 #define MEMORYPOOL_H
32 
33 #include "mhd_options.h"
34 #ifdef HAVE_STDDEF_H
35 #include <stddef.h>
36 #endif /* HAVE_STDDEF_H */
37 #ifdef HAVE_STDBOOL_H
38 #include <stdbool.h>
39 #endif
40 
46 struct MemoryPool;
47 
51 void
52 MHD_init_mem_pools_ (void);
53 
54 
61 struct MemoryPool *
62 MHD_pool_create (size_t max);
63 
64 
70 void
71 MHD_pool_destroy (struct MemoryPool *pool);
72 
73 
85 void *
86 MHD_pool_allocate (struct MemoryPool *pool,
87  size_t size,
88  bool from_end);
89 
100 bool
101 MHD_pool_is_resizable_inplace (struct MemoryPool *pool,
102  void *block,
103  size_t block_size);
104 
124 void *
125 MHD_pool_try_alloc (struct MemoryPool *pool,
126  size_t size,
127  size_t *required_bytes);
128 
129 
147 void *
148 MHD_pool_reallocate (struct MemoryPool *pool,
149  void *old,
150  size_t old_size,
151  size_t new_size);
152 
153 
160 size_t
161 MHD_pool_get_free (struct MemoryPool *pool);
162 
163 
176 void
177 MHD_pool_deallocate (struct MemoryPool *pool,
178  void *block,
179  size_t block_size);
180 
181 
195 void *
196 MHD_pool_reset (struct MemoryPool *pool,
197  void *keep,
198  size_t copy_bytes,
199  size_t new_size);
200 
201 #endif
void MHD_pool_destroy(struct MemoryPool *pool)
Definition: memorypool.c:157
void * MHD_pool_reallocate(struct MemoryPool *pool, void *old, size_t old_size, size_t new_size)
Definition: memorypool.c:248
size_t MHD_pool_get_free(struct MemoryPool *pool)
Definition: memorypool.c:185
struct MemoryPool * MHD_pool_create(size_t max)
Definition: memorypool.c:102
void * MHD_pool_reset(struct MemoryPool *pool, void *keep, size_t copy_bytes, size_t new_size)
Definition: memorypool.c:314
void * MHD_pool_allocate(struct MemoryPool *pool, size_t size, int from_end)
Definition: memorypool.c:203
additional automatic macros for MHD_config.h
void MHD_init_mem_pools_(void)
Definition: memorypool.c:209
bool MHD_pool_is_resizable_inplace(struct MemoryPool *pool, void *block, size_t block_size)
Definition: memorypool.c:440
void * MHD_pool_try_alloc(struct MemoryPool *pool, size_t size, size_t *required_bytes)
Definition: memorypool.c:481
void MHD_pool_deallocate(struct MemoryPool *pool, void *block, size_t block_size)
Definition: memorypool.c:625