Apache HTTPD
apr_pools.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_POOLS_H
18#define APR_POOLS_H
19
43#include "apr.h"
44#include "apr_errno.h"
45#include "apr_general.h" /* for APR_STRINGIFY */
46#define APR_WANT_MEMFUNC
47#include "apr_want.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
60typedef struct apr_pool_t apr_pool_t;
61
62
81#define APR_POOL_DECLARE_ACCESSOR(type) \
82 APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
83 (const apr_##type##_t *the##type)
84
91#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
92 APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
93 (const apr_##type##_t *the##type) \
94 { return the##type->pool; }
95
96
132#if defined(APR_POOL_DEBUG)
133/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
134#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
135#undef APR_POOL_DEBUG
136#define APR_POOL_DEBUG 1
137#endif
138#else
139#define APR_POOL_DEBUG 0
140#endif
141
143#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
144
145
146
149
150/*
151 * APR memory structure manipulators (pools, tables, and arrays).
152 */
153
154/*
155 * Initialization
156 */
157
165
173
174
175/*
176 * Pool creation/destruction
177 */
178
179#include "apr_allocator.h"
180
201
209
230
251 const char *file_line)
253
254#if APR_POOL_DEBUG
255#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
256 apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
257 APR_POOL__FILE_LINE__)
258#endif
259
267 const char *file_line);
268
287 const char *file_line)
289
290#if APR_POOL_DEBUG
291#define apr_pool_create_core_ex(newpool, abort_fn, allocator) \
292 apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
293 APR_POOL__FILE_LINE__)
294
295#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator) \
296 apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
297 APR_POOL__FILE_LINE__)
298
299#endif
300
313#if defined(DOXYGEN)
316#else
317#if APR_POOL_DEBUG
318#define apr_pool_create(newpool, parent) \
319 apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
320 APR_POOL__FILE_LINE__)
321#else
322#define apr_pool_create(newpool, parent) \
323 apr_pool_create_ex(newpool, parent, NULL, NULL)
324#endif
325#endif
326
331#if defined(DOXYGEN)
334#else
335#if APR_POOL_DEBUG
336#define apr_pool_create_core(newpool) \
337 apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
338 APR_POOL__FILE_LINE__)
339#define apr_pool_create_unmanaged(newpool) \
340 apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
341 APR_POOL__FILE_LINE__)
342#else
343#define apr_pool_create_core(newpool) \
344 apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
345#define apr_pool_create_unmanaged(newpool) \
346 apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
347#endif
348#endif
349
356
366
381 const char *file_line)
383
384#if APR_POOL_DEBUG
385#define apr_pool_clear(p) \
386 apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
387#endif
388
396
411 const char *file_line)
413
414#if APR_POOL_DEBUG
415#define apr_pool_destroy(p) \
416 apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
417#endif
418
419
420/*
421 * Memory allocation
422 */
423
431#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
433#endif
435
445 const char *file_line)
446#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
448#endif
450
451#if APR_POOL_DEBUG
452#define apr_palloc(p, size) \
453 apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
454#endif
455
462#if defined(DOXYGEN)
464#elif !APR_POOL_DEBUG
465#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
466#endif
467
477 const char *file_line)
479
480#if APR_POOL_DEBUG
481#define apr_pcalloc(p, size) \
482 apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
483#endif
484
485
486/*
487 * Pool Properties
488 */
489
501
509
517
530
538
539
540/*
541 * User data management
542 */
543
564 const char *key,
568
589 const void *data, const char *key,
590 apr_status_t (*cleanup)(void *),
592 __attribute__((nonnull(2,4)));
593
603
604
632 __attribute__((nonnull(3,4)));
633
647 apr_pool_t *p, const void *data,
648 apr_status_t (*plain_cleanup)(void *))
650
664 apr_status_t (*cleanup)(void *))
666
680 apr_pool_t *p, const void *data,
681 apr_status_t (*plain_cleanup)(void *),
682 apr_status_t (*child_cleanup)(void *))
683 __attribute__((nonnull(3,4)));
684
697 apr_status_t (*cleanup)(void *))
699
708
716
761#if APR_POOL_DEBUG || defined(DOXYGEN)
769
776
785
792
795#else /* APR_POOL_DEBUG or DOXYGEN */
796
797#ifdef apr_pool_join
798#undef apr_pool_join
799#endif
800#define apr_pool_join(a,b)
801
802#ifdef apr_pool_lock
803#undef apr_pool_lock
804#endif
805#define apr_pool_lock(pool, lock)
806
807#endif /* APR_POOL_DEBUG or DOXYGEN */
808
811#ifdef __cplusplus
812}
813#endif
814
815#endif /* !APR_POOLS_H */
APR Internal Memory Allocation.
APR Error Codes.
APR Miscellaneous library routines.
APR Standard Headers Support.
apr_bucket apr_bucket_brigade * a
const void apr_status_t(*) apr_status_t(* child_cleanup)(void *)) __attribute__((nonnull(3
Definition apr_pools.h:631
const void * data
Definition apr_pools.h:629
const void apr_status_t(* plain_cleanup)(void *)
Definition apr_pools.h:630
const void apr_status_t(*) apr_status_t(* APR_DECLARE)(void) apr_pool_pre_cleanup_register(apr_pool_t *p
Definition apr_pools.h:646
#define apr_pool_join(a, b)
Definition apr_pools.h:800
#define apr_pool_lock(pool, lock)
Definition apr_pools.h:805
const char int apr_pool_t * pool
Definition apr_cstr.h:84
int apr_status_t
Definition apr_errno.h:44
const char apr_int32_t flag
APR_DECLARE_NONSTD(void) apr_terminate(void)
Definition start.c:173
#define apr_pool_create_unmanaged(newpool)
Definition apr_pools.h:345
apr_pool_t * b
Definition apr_pools.h:529
int(* apr_abortfunc_t)(int retcode)
Definition apr_pools.h:148
apr_abortfunc_t apr_allocator_t * allocator
Definition apr_pools.h:208
apr_pool_t * parent
Definition apr_pools.h:197
const char apr_status_t(*) apr_pool_t *poo __attribute__)((nonnull(2, 4)))
Definition apr_pools.h:567
apr_size_t size
Definition apr_pools.h:444
apr_abortfunc_t apr_allocator_t const char * file_line
Definition apr_pools.h:267
const char apr_status_t(* cleanup)(void *)
Definition apr_pools.h:565
#define apr_pool_create(newpool, parent)
Definition apr_pools.h:322
#define apr_pool_create_core(newpool)
Definition apr_pools.h:343
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
const char * key
Definition apr_pools.h:564
apr_pool_t apr_abortfunc_t abort_fn
Definition apr_pools.h:198
void * mem
apr_pool_t * p
Definition md_event.c:32
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray