Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
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 
107 #include "apr_pools.h"
108 
115 /*
116  * XXX: see if we can come up with something a bit better. Currently
117  * you can make a pool an owner, but if the pool doesn't use the allocator
118  * the allocator will never be destroyed.
119  */
121  apr_pool_t *pool)
122  __attribute__((nonnull(1)));
123 
129  __attribute__((nonnull(1)));
130 
139  __attribute__((nonnull(1)));
140 
141 #include "apr_thread_mutex.h"
142 
143 #if APR_HAS_THREADS
144 
150  apr_thread_mutex_t *mutex)
151  __attribute__((nonnull(1)));
152 
158  apr_allocator_t *allocator)
159  __attribute__((nonnull(1)));
160 
161 #endif /* APR_HAS_THREADS */
162 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* !APR_ALLOCATOR_H */
size_t apr_size_t
Definition: apr.h:375
void void apr_allocator_owner_set(apr_allocator_t *allocator, apr_pool_t *pool) __attribute__((nonnull(1)))
char * endp
Definition: apr_allocator.h:60
apr_uint32_t free_index
Definition: apr_allocator.h:58
Definition: apr_arch_thread_mutex.h:28
apr_thread_mutex_t * apr_allocator_mutex_get(apr_allocator_t *allocator) __attribute__((nonnull(1)))
char * first_avail
Definition: apr_allocator.h:59
apr_memnode_t * apr_allocator_alloc(apr_allocator_t *allocator, apr_size_t size) __attribute__((nonnull(1)))
apr_status_t __attribute__((nonnull(1)))
Definition: apr_allocator.h:54
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:556
struct apr_allocator_t apr_allocator_t
Definition: apr_allocator.h:41
void apr_allocator_max_free_set(apr_allocator_t *allocator, apr_size_t size) __attribute__((nonnull(1)))
apr_memnode_t * next
Definition: apr_allocator.h:55
dav_buffer apr_size_t size
Definition: mod_dav.h:461
apr_uint32_t index
Definition: apr_allocator.h:57
void apr_allocator_free(apr_allocator_t *allocator, apr_memnode_t *memnode) __attribute__((nonnull(1
void apr_allocator_mutex_set(apr_allocator_t *allocator, apr_thread_mutex_t *mutex) __attribute__((nonnull(1)))
APR Error Codes.
unsigned int apr_uint32_t
Definition: apr.h:334
APR Platform Definitions.
apr_pool_t * apr_allocator_owner_get(apr_allocator_t *allocator) __attribute__((nonnull(1)))
#define APR_DECLARE(x)
Definition: macros.h:6
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
void apr_allocator_destroy(apr_allocator_t *allocator) __attribute__((nonnull(1)))
apr_memnode_t ** ref
Definition: apr_allocator.h:56
apr_status_t apr_allocator_create(apr_allocator_t **allocator) __attribute__((nonnull(1)))