summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/pool_policy_new.cpp
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-04-30 21:03:32 +0000
committerBenny Prijono <bennylp@teluu.com>2007-04-30 21:03:32 +0000
commit9bfdd11aac28c934ce580880837cce948d9be10a (patch)
treee0414666d0e0b7b7ac99adb0125acf7b988b8428 /pjlib/src/pj/pool_policy_new.cpp
parent25830dbc54149caeb660f1f379e547ed9eb09159 (diff)
Initial Symbian integration to trunk for pjlib
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1235 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/pool_policy_new.cpp')
-rw-r--r--pjlib/src/pj/pool_policy_new.cpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/pjlib/src/pj/pool_policy_new.cpp b/pjlib/src/pj/pool_policy_new.cpp
new file mode 100644
index 00000000..367be0f3
--- /dev/null
+++ b/pjlib/src/pj/pool_policy_new.cpp
@@ -0,0 +1,73 @@
+/* $Id$ */
+/*
+ * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <pj/pool.h>
+#include <pj/except.h>
+#include <pj/os.h>
+
+#if !PJ_HAS_POOL_ALT_API
+
+/*
+ * This file contains pool default policy definition and implementation.
+ */
+
+
+static void *operator_new(pj_pool_factory *factory, pj_size_t size)
+{
+ PJ_CHECK_STACK();
+ PJ_UNUSED_ARG(factory);
+ PJ_UNUSED_ARG(size);
+
+ return new char[size];
+}
+
+static void operator_delete(pj_pool_factory *factory, void *mem, pj_size_t size)
+{
+ PJ_CHECK_STACK();
+ PJ_UNUSED_ARG(factory);
+ PJ_UNUSED_ARG(size);
+
+ char *p = (char*)mem;
+ delete [] p;
+}
+
+static void default_pool_callback(pj_pool_t *pool, pj_size_t size)
+{
+ PJ_CHECK_STACK();
+ PJ_UNUSED_ARG(pool);
+ PJ_UNUSED_ARG(size);
+
+ PJ_THROW(PJ_NO_MEMORY_EXCEPTION);
+}
+
+pj_pool_factory_policy pj_pool_factory_default_policy =
+{
+ &operator_new,
+ &operator_delete,
+ &default_pool_callback,
+ 0
+};
+
+PJ_DEF(pj_pool_factory_policy*) pj_pool_factory_get_default_policy(void)
+{
+ return &pj_pool_factory_default_policy;
+}
+
+
+#endif /* PJ_HAS_POOL_ALT_API */
+