Apache2
apr_allocator.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APR_ALLOCATOR_H
18 #define APR_ALLOCATOR_H
19 
25 #include "apr.h"
26 #include "apr_errno.h"
27 #define APR_WANT_MEMFUNC
28 #include "apr_want.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
41 typedef struct apr_allocator_t apr_allocator_t;
43 typedef struct apr_memnode_t apr_memnode_t;
44 
54 struct apr_memnode_t {
59  char *first_avail;
60  char *endp;
61 };
62 
64 #define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
65 
67 #define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0
68 
75  __attribute__((nonnull(1)));
76 
84  __attribute__((nonnull(1)));
85 
94  __attribute__((nonnull(1)));
95 
104  apr_memnode_t *memnode)
105  __attribute__((nonnull(1,2)));
106 
112 
121 
130  apr_size_t size);
131 
132 #include "apr_pools.h"
133 
140 /*
141  * XXX: see if we can come up with something a bit better. Currently
142  * you can make a pool an owner, but if the pool doesn't use the allocator
143  * the allocator will never be destroyed.
144  */
146  apr_pool_t *pool)
147  __attribute__((nonnull(1)));
148 
154  __attribute__((nonnull(1)));
155 
164  __attribute__((nonnull(1)));
165 
166 #include "apr_thread_mutex.h"
167 
168 #if APR_HAS_THREADS
175  apr_thread_mutex_t *mutex)
176  __attribute__((nonnull(1)));
177 
183  apr_allocator_t *allocator)
184  __attribute__((nonnull(1)));
185 
186 #endif /* APR_HAS_THREADS */
187 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif /* !APR_ALLOCATOR_H */
APR Platform Definitions.
APR Error Codes.
APR memory allocation.
APR Thread Mutex Routines.
APR Standard Headers Support.
dav_buffer apr_size_t size
Definition: mod_dav.h:461
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
struct apr_allocator_t apr_allocator_t
Definition: apr_allocator.h:41
void apr_allocator_mutex_set(apr_allocator_t *allocator, apr_thread_mutex_t *mutex) __attribute__((nonnull(1)))
void apr_allocator_destroy(apr_allocator_t *allocator) __attribute__((nonnull(1)))
void apr_allocator_max_free_set(apr_allocator_t *allocator, apr_size_t size) __attribute__((nonnull(1)))
apr_thread_mutex_t * apr_allocator_mutex_get(apr_allocator_t *allocator) __attribute__((nonnull(1)))
apr_pool_t * apr_allocator_owner_get(apr_allocator_t *allocator) __attribute__((nonnull(1)))
apr_size_t apr_allocator_align(apr_allocator_t *allocator, apr_size_t size)
void apr_allocator_owner_set(apr_allocator_t *allocator, apr_pool_t *pool) __attribute__((nonnull(1)))
apr_status_t apr_allocator_create(apr_allocator_t **allocator) __attribute__((nonnull(1)))
apr_status_t apr_allocator_min_order_set(unsigned int order)
void apr_size_t apr_allocator_page_size(void)
void apr_allocator_free(apr_allocator_t *allocator, apr_memnode_t *memnode) __attribute__((nonnull(1
apr_memnode_t * apr_allocator_alloc(apr_allocator_t *allocator, apr_size_t size) __attribute__((nonnull(1)))
int apr_status_t
Definition: apr_errno.h:44
unsigned int apr_uint32_t
Definition: apr.h:348
#define __attribute__(__x)
Definition: apr.h:63
size_t apr_size_t
Definition: apr.h:394
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
#define APR_DECLARE(x)
Definition: macros.h:6
Definition: apr_allocator.h:54
apr_memnode_t * next
Definition: apr_allocator.h:55
char * endp
Definition: apr_allocator.h:60
apr_uint32_t index
Definition: apr_allocator.h:57
char * first_avail
Definition: apr_allocator.h:59
apr_memnode_t ** ref
Definition: apr_allocator.h:56
apr_uint32_t free_index
Definition: apr_allocator.h:58
Definition: apr_arch_thread_mutex.h:28