diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-07-12 09:31:34 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-07-12 09:31:34 +0000 |
commit | 132cbda37abce5fd5703f696ee8fb42cfd6fd41f (patch) | |
tree | afa85b9470f660e5b0a18d9ec800602b7a58d754 /pjlib/src/pj/pool_dbg.c | |
parent | c90da3b928fb3ee1b215abfb291a69bf2b78a3d8 (diff) |
Ticket 559 (minor): Update the pool alternative API (pool_alt.h) with the latest pool API
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2123 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/pool_dbg.c')
-rw-r--r-- | pjlib/src/pj/pool_dbg.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/pjlib/src/pj/pool_dbg.c b/pjlib/src/pj/pool_dbg.c index 71dd5647..1cc5bccd 100644 --- a/pjlib/src/pj/pool_dbg.c +++ b/pjlib/src/pj/pool_dbg.c @@ -19,7 +19,7 @@ #include <pj/pool.h> #include <pj/string.h> -#if PJ_POOL_DEBUG +#if PJ_HAS_POOL_ALT_API #if PJ_HAS_MALLOC_H # include <malloc.h> @@ -41,24 +41,14 @@ //#undef TRACE_ -struct pj_pool_mem -{ - struct pj_pool_mem *next; - /* data follows immediately */ -}; +int PJ_NO_MEMORY_EXCEPTION; -struct pj_pool_t +PJ_DEF(int) pj_NO_MEMORY_EXCEPTION() { - struct pj_pool_mem *first_mem; - pj_size_t used_size; - pj_pool_callback *cb; -}; - - -int PJ_NO_MEMORY_EXCEPTION; - + return PJ_NO_MEMORY_EXCEPTION; +} /* Create pool */ PJ_DEF(pj_pool_t*) pj_pool_create_imp( const char *file, int line, @@ -73,7 +63,6 @@ PJ_DEF(pj_pool_t*) pj_pool_create_imp( const char *file, int line, PJ_UNUSED_ARG(file); PJ_UNUSED_ARG(line); PJ_UNUSED_ARG(factory); - PJ_UNUSED_ARG(name); PJ_UNUSED_ARG(initial_size); PJ_UNUSED_ARG(increment_size); @@ -81,6 +70,14 @@ PJ_DEF(pj_pool_t*) pj_pool_create_imp( const char *file, int line, if (!pool) return NULL; + if (name) { + pj_ansi_strncpy(pool->obj_name, name, sizeof(pool->obj_name)); + pool->obj_name[sizeof(pool->obj_name)-1] = '\0'; + } else { + strcpy(pool->obj_name, "altpool"); + } + + pool->factory = NULL; pool->first_mem = NULL; pool->used_size = 0; pool->cb = callback; @@ -184,8 +181,9 @@ PJ_DEF(void*) pj_pool_calloc_imp( const char *file, int line, PJ_DEF(void*) pj_pool_zalloc_imp( const char *file, int line, pj_pool_t *pool, pj_size_t sz) { - return pj_pool_calloc_imp(file, line, pool, 1, sz); + return pj_pool_calloc_imp(file, line, pool, 1, sz); } -#endif /* PJ_POOL_DEBUG */ + +#endif /* PJ_HAS_POOL_ALT_API */ |