GNU libmicrohttpd  0.9.76
memorypool.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2007--2019 Daniel Pittman, Christian Grothoff and
4  Karlson2k (Evgeny Grin)
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 
90 
110 void *
111 MHD_pool_try_alloc (struct MemoryPool *pool,
112  size_t size,
113  size_t *required_bytes);
114 
115 
133 void *
134 MHD_pool_reallocate (struct MemoryPool *pool,
135  void *old,
136  size_t old_size,
137  size_t new_size);
138 
139 
146 size_t
147 MHD_pool_get_free (struct MemoryPool *pool);
148 
149 
163 void *
164 MHD_pool_reset (struct MemoryPool *pool,
165  void *keep,
166  size_t copy_bytes,
167  size_t new_size);
168 
169 #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:136
void * MHD_pool_try_alloc(struct MemoryPool *pool, size_t size, size_t *required_bytes)
Definition: memorypool.c:373