2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "apr_pools.h"
20 #include "qs_malloc.h"
26 qs_init_malloc(Doc *doc)
30 rtn = apr_allocator_create(&(doc->allocator));
31 if (rtn != APR_SUCCESS) {
32 QX_LOGGER_FATAL("Out Of Memory");
34 rtn = apr_pool_create_ex(&(doc->pool), NULL, NULL, doc->allocator);
35 if (rtn != APR_SUCCESS) {
36 QX_LOGGER_FATAL("Out Of Memory");
39 doc->do_init_flag = 1;
47 qs_all_free(Doc *doc, const char *UNUSED(fname), int UNUSED(line))
49 if (doc->do_init_flag) {
50 apr_pool_destroy(doc->pool);
52 apr_allocator_destroy(doc->allocator);
53 doc->do_init_flag = 0;
61 #include <sys/types.h>
65 void *rpl_malloc(size_t n) { if (n == 0) n = 1; return malloc (n); }