Subversion
svn_pools.h
Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_pools.h
00024  * @brief APR pool management for Subversion
00025  */
00026 
00027 
00028 
00029 
00030 #ifndef SVN_POOLS_H
00031 #define SVN_POOLS_H
00032 
00033 #include <apr_pools.h>
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif /* __cplusplus */
00038 
00039 
00040 
00041 /* Wrappers around APR pools, so we get debugging. */
00042 
00043 /** The recommended maximum amount of memory (4MB) to keep in an APR
00044  * allocator on the free list, conveniently defined here to share
00045  * between all our applications.
00046  */
00047 #define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE (4096 * 1024)
00048 
00049 
00050 /** Wrapper around apr_pool_create_ex(), with a simpler interface.
00051  * The return pool will have an abort function set, which will call
00052  * abort() on OOM.
00053  */
00054 apr_pool_t *
00055 svn_pool_create_ex(apr_pool_t *parent_pool,
00056                    apr_allocator_t *allocator);
00057 
00058 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00059 apr_pool_t *
00060 svn_pool_create_ex_debug(apr_pool_t *parent_pool,
00061                          apr_allocator_t *allocator,
00062                          const char *file_line);
00063 
00064 #if APR_POOL_DEBUG
00065 #define svn_pool_create_ex(pool, allocator) \
00066 svn_pool_create_ex_debug(pool, allocator, APR_POOL__FILE_LINE__)
00067 
00068 #endif /* APR_POOL_DEBUG */
00069 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00070 
00071 
00072 /** Create a pool as a subpool of @a parent_pool */
00073 #define svn_pool_create(parent_pool) svn_pool_create_ex(parent_pool, NULL)
00074 
00075 /** Clear a @a pool destroying its children.
00076  *
00077  * This define for @c svn_pool_clear exists for completeness.
00078  */
00079 #define svn_pool_clear apr_pool_clear
00080 
00081 
00082 /** Destroy a @a pool and all of its children.
00083  *
00084  * This define for @c svn_pool_destroy exists for symmetry and
00085  * completeness.
00086  */
00087 #define svn_pool_destroy apr_pool_destroy
00088 
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif /* __cplusplus */
00093 
00094 #endif /* SVN_POOLS_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines