Subversion 1.6.16

svn_pools.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  * Copyright (c) 2000-2004, 2008 CollabNet.  All rights reserved.
00005  *
00006  * This software is licensed as described in the file COPYING, which
00007  * you should have received as part of this distribution.  The terms
00008  * are also available at http://subversion.tigris.org/license-1.html.
00009  * If newer versions of this license are posted there, you may use a
00010  * newer version instead, at your option.
00011  *
00012  * This software consists of voluntary contributions made by many
00013  * individuals.  For exact contribution history, see the revision
00014  * history and logs, available at http://subversion.tigris.org/.
00015  * ====================================================================
00016  * @endcopyright
00017  *
00018  * @file svn_pools.h
00019  * @brief APR pool management for Subversion
00020  */
00021 
00022 
00023 
00024 
00025 #ifndef SVN_POOLS_H
00026 #define SVN_POOLS_H
00027 
00028 #include <apr_pools.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif /* __cplusplus */
00033 
00034 
00035 
00036 /* Wrappers around APR pools, so we get debugging. */
00037 
00038 /** The recommended maximum amount of memory (4MB) to keep in an APR
00039  * allocator on the free list, conveniently defined here to share
00040  * between all our applications.
00041  */
00042 #define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE (4096 * 1024)
00043 
00044 
00045 /** Wrapper around apr_pool_create_ex(), with a simpler interface.
00046  * The return pool will have an abort function set, which will call
00047  * abort() on OOM.
00048  */
00049 apr_pool_t *
00050 svn_pool_create_ex(apr_pool_t *parent_pool,
00051                    apr_allocator_t *allocator);
00052 
00053 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00054 apr_pool_t *
00055 svn_pool_create_ex_debug(apr_pool_t *parent_pool,
00056                          apr_allocator_t *allocator,
00057                          const char *file_line);
00058 
00059 #if APR_POOL_DEBUG
00060 #define svn_pool_create_ex(pool, allocator) \
00061 svn_pool_create_ex_debug(pool, allocator, APR_POOL__FILE_LINE__)
00062 
00063 #endif /* APR_POOL_DEBUG */
00064 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00065 
00066 
00067 /** Create a pool as a subpool of @a parent_pool */
00068 #define svn_pool_create(parent_pool) svn_pool_create_ex(parent_pool, NULL)
00069 
00070 /** Clear a @a pool destroying its children.
00071  *
00072  * This define for @c svn_pool_clear exists for completeness.
00073  */
00074 #define svn_pool_clear apr_pool_clear
00075 
00076 
00077 /** Destroy a @a pool and all of its children.
00078  *
00079  * This define for @c svn_pool_destroy exists for symmetry and
00080  * completeness.
00081  */
00082 #define svn_pool_destroy apr_pool_destroy
00083 
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif /* __cplusplus */
00088 
00089 #endif /* SVN_POOLS_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines