Change the format of the revprops block sent in svnserve for
[svn.git] / subversion / libsvn_subr / pool.c
blob08ade68ab304ef41b7704fc36ff8dad8b565ab2a
1 /* pool.c: pool wrappers for Subversion
3 * ====================================================================
4 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
20 #include <stdarg.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <assert.h>
25 #include <apr_general.h>
26 #include <apr_pools.h>
28 #include "svn_pools.h"
31 #if APR_POOL_DEBUG
32 /* file_line for the non-debug case. */
33 static const char SVN_FILE_LINE_UNDEFINED[] = "svn:<undefined>";
34 #endif /* APR_POOL_DEBUG */
38 /*-----------------------------------------------------------------*/
41 /* Pool allocation handler which just aborts, since we aren't generally
42 prepared to deal with out-of-memory errors.
44 static int
45 abort_on_pool_failure(int retcode)
47 /* Don't translate this string! It requires memory allocation to do so!
48 And we don't have any of it... */
49 printf("Out of memory - terminating application.\n");
50 abort();
51 return -1; /* prevent compiler warnings */
55 #if APR_POOL_DEBUG
56 #undef svn_pool_create_ex
57 #endif /* APR_POOL_DEBUG */
59 #if !APR_POOL_DEBUG
61 apr_pool_t *
62 svn_pool_create_ex(apr_pool_t *parent_pool, apr_allocator_t *allocator)
64 apr_pool_t *pool;
65 apr_pool_create_ex(&pool, parent_pool, abort_on_pool_failure, allocator);
66 return pool;
69 /* Wrapper that ensures binary compatibility */
70 apr_pool_t *
71 svn_pool_create_ex_debug(apr_pool_t *pool, apr_allocator_t *allocator,
72 const char *file_line)
74 return svn_pool_create_ex(pool, allocator);
77 #else /* APR_POOL_DEBUG */
79 apr_pool_t *
80 svn_pool_create_ex_debug(apr_pool_t *parent_pool, apr_allocator_t *allocator,
81 const char *file_line)
83 apr_pool_t *pool;
84 apr_pool_create_ex_debug(&pool, parent_pool, abort_on_pool_failure,
85 allocator, file_line);
86 return pool;
89 /* Wrapper that ensures binary compatibility */
90 apr_pool_t *
91 svn_pool_create_ex(apr_pool_t *pool, apr_allocator_t *allocator)
93 return svn_pool_create_ex_debug(pool, allocator, SVN_FILE_LINE_UNDEFINED);
96 #endif /* APR_POOL_DEBUG */