OSDN Git Service

Success build TortoiseMerge.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / libsvn_diff / pool.c
1 /* pool.c:  pool wrappers for Subversion\r
2  *\r
3  * ====================================================================\r
4  * Copyright (c) 2000-2007 CollabNet.  All rights reserved.\r
5  *\r
6  * This software is licensed as described in the file COPYING, which\r
7  * you should have received as part of this distribution.  The terms\r
8  * are also available at http://subversion.tigris.org/license-1.html.\r
9  * If newer versions of this license are posted there, you may use a\r
10  * newer version instead, at your option.\r
11  *\r
12  * This software consists of voluntary contributions made by many\r
13  * individuals.  For exact contribution history, see the revision\r
14  * history and logs, available at http://subversion.tigris.org/.\r
15  * ====================================================================\r
16  */\r
17 \r
18 \r
19 \f\r
20 #include <stdarg.h>\r
21 #include <stdlib.h>\r
22 #include <stdio.h>\r
23 \r
24 #include <apr_general.h>\r
25 #include <apr_pools.h>\r
26 \r
27 #include "svn_pools.h"\r
28 \r
29 \r
30 #if APR_POOL_DEBUG\r
31 /* file_line for the non-debug case. */\r
32 static const char SVN_FILE_LINE_UNDEFINED[] = "svn:<undefined>";\r
33 #endif /* APR_POOL_DEBUG */\r
34 \r
35 \r
36 \f\r
37 /*-----------------------------------------------------------------*/\r
38 \r
39 \r
40 /* Pool allocation handler which just aborts, since we aren't generally\r
41    prepared to deal with out-of-memory errors.\r
42  */\r
43 static int\r
44 abort_on_pool_failure(int retcode)\r
45 {\r
46   /* Don't translate this string! It requires memory allocation to do so!\r
47      And we don't have any of it... */\r
48   printf("Out of memory - terminating application.\n");\r
49   abort();\r
50 }\r
51 \r
52 \r
53 #if APR_POOL_DEBUG\r
54 #undef svn_pool_create_ex\r
55 #endif /* APR_POOL_DEBUG */\r
56 \r
57 #if !APR_POOL_DEBUG\r
58 \r
59 apr_pool_t *\r
60 svn_pool_create_ex(apr_pool_t *parent_pool, apr_allocator_t *allocator)\r
61 {\r
62   apr_pool_t *pool;\r
63   apr_pool_create_ex(&pool, parent_pool, abort_on_pool_failure, allocator);\r
64   return pool;\r
65 }\r
66 \r
67 /* Wrapper that ensures binary compatibility */\r
68 apr_pool_t *\r
69 svn_pool_create_ex_debug(apr_pool_t *pool, apr_allocator_t *allocator,\r
70                          const char *file_line)\r
71 {\r
72   return svn_pool_create_ex(pool, allocator);\r
73 }\r
74 \r
75 #else /* APR_POOL_DEBUG */\r
76 \r
77 apr_pool_t *\r
78 svn_pool_create_ex_debug(apr_pool_t *parent_pool, apr_allocator_t *allocator,\r
79                          const char *file_line)\r
80 {\r
81   apr_pool_t *pool;\r
82   apr_pool_create_ex_debug(&pool, parent_pool, abort_on_pool_failure,\r
83                            allocator, file_line);\r
84   return pool;\r
85 }\r
86 \r
87 /* Wrapper that ensures binary compatibility */\r
88 apr_pool_t *\r
89 svn_pool_create_ex(apr_pool_t *pool, apr_allocator_t *allocator)\r
90 {\r
91   return svn_pool_create_ex_debug(pool, allocator, SVN_FILE_LINE_UNDEFINED);\r
92 }\r
93 \r
94 #endif /* APR_POOL_DEBUG */\r