4 #include <apr-1/apr_pools.h>
5 #include <apr-1/apr_strings.h>
7 #include <minimal/stdlib.h>
9 _finline void *operator new(size_t size, apr_pool_t *pool) {
10 return apr_palloc(pool, size);
13 _finline void *operator new [](size_t size, apr_pool_t *pool) {
14 return apr_palloc(pool, size);
23 _aprcall(apr_pool_create(&pool_, NULL));
27 apr_pool_destroy(pool_);
31 apr_pool_clear(pool_);
34 operator apr_pool_t *() const {
38 char *operator ()(const char *data) const {
39 return apr_pstrdup(pool_, data);
42 char *operator ()(const char *data, size_t size) const {
43 return apr_pstrndup(pool_, data, size);
53 static void *operator new(size_t size, apr_pool_t *pool) {
54 void *data(apr_palloc(pool, size));
55 reinterpret_cast<CYData *>(data)->pool_ = pool;
59 static void *operator new(size_t size) {
61 _aprcall(apr_pool_create(&pool, NULL));
62 return operator new(size, pool);
65 static void operator delete(void *data) {
66 apr_pool_destroy(reinterpret_cast<CYData *>(data)->pool_);
71 #endif/*CYPOOLING_HPP*/