00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Copyright (c) 2000-2004 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.h> 00029 #include <apr_errno.h> /* APR's error system */ 00030 #include <apr_pools.h> 00031 00032 #include "svn_types.h" 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif /* __cplusplus */ 00037 00038 00039 00040 /* Wrappers around APR pools, so we get debugging. */ 00041 00042 /** The recommended maximum amount of memory (4MB) to keep in an APR 00043 * allocator on the free list, conveniently defined here to share 00044 * between all our applications. 00045 */ 00046 #define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE (4096 * 1024) 00047 00048 00049 /** Wrapper around apr_pool_create_ex(), with a simpler interface. 00050 * The return pool will have an abort function set, which will call 00051 * abort() on OOM. 00052 */ 00053 apr_pool_t *svn_pool_create_ex(apr_pool_t *parent_pool, 00054 apr_allocator_t *allocator); 00055 00056 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00057 apr_pool_t *svn_pool_create_ex_debug(apr_pool_t *parent_pool, 00058 apr_allocator_t *allocator, 00059 const char *file_line); 00060 00061 #if APR_POOL_DEBUG 00062 #define svn_pool_create_ex(pool, allocator) \ 00063 svn_pool_create_ex_debug(pool, allocator, APR_POOL__FILE_LINE__) 00064 00065 #endif /* APR_POOL_DEBUG */ 00066 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00067 00068 00069 /** Create a pool as a subpool of @a parent_pool */ 00070 #define svn_pool_create(pool) svn_pool_create_ex(pool, NULL) 00071 00072 /** Clear a @a pool destroying its children. 00073 * 00074 * This define for @c svn_pool_clear exists for completeness. 00075 */ 00076 #define svn_pool_clear apr_pool_clear 00077 00078 00079 /** Destroy a @a pool and all of its children. 00080 * 00081 * This define for @c svn_pool_destroy exists for symmetry and 00082 * completeness. 00083 */ 00084 #define svn_pool_destroy apr_pool_destroy 00085 00086 00087 #ifdef __cplusplus 00088 } 00089 #endif /* __cplusplus */ 00090 00091 #endif /* SVN_POOLS_H */