diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-03-14 09:47:56 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2011-03-14 09:47:56 +0100 |
commit | 7f8194a7d87a87b391ac1ee28c55870cdbc56ba0 (patch) | |
tree | 207aae7b6a00d2d4cbcf1d5c4516b00f86634e17 /tools | |
parent | 5342a87464932ce062004e3587bd4339a10035db (diff) | |
parent | f59ba28bac7a38bb86e10779ca38276259dc79e7 (diff) |
debuglevels: pulled and merged DEV300.m102
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/mempool.hxx | 17 | ||||
-rwxr-xr-x | tools/source/memtools/mempool.cxx | 14 | ||||
-rw-r--r-- | tools/workben/makefile.mk | 68 | ||||
-rw-r--r-- | tools/workben/mempooltest.cxx | 18 |
4 files changed, 106 insertions, 11 deletions
diff --git a/tools/inc/tools/mempool.hxx b/tools/inc/tools/mempool.hxx index 4c6c68ab0dd9..74df068908f7 100644 --- a/tools/inc/tools/mempool.hxx +++ b/tools/inc/tools/mempool.hxx @@ -28,7 +28,7 @@ #define _SVMEMPOOL_HXX #include "tools/toolsdllapi.h" -#include <tools/solar.h> +#include "tools/solar.h" // ---------------- // - FixedMemPool - @@ -39,9 +39,11 @@ struct FixedMemPool_Impl; class TOOLS_DLLPUBLIC FixedMemPool { FixedMemPool_Impl * m_pImpl; + char const * m_pTypeName; public: - FixedMemPool( sal_uInt16 nTypeSize, + FixedMemPool( char const * pTypeName, + sal_uInt16 nTypeSize, sal_uInt16 nInitSize = 512, sal_uInt16 nGrowSize = 256 ); ~FixedMemPool(); @@ -97,8 +99,11 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) DECL_FIXEDMEMPOOL_NEW_INLINE( Class, aPool ) \ DECL_FIXEDMEMPOOL_DEL_INLINE( Class, aPool ) +#define IMPL_FIXEDMEMPOOL_STRING(x) IMPL_FIXEDMEMPOOL_MAKESTRING(x) +#define IMPL_FIXEDMEMPOOL_MAKESTRING(x) #x + #define IMPL_FIXEDMEMPOOL_NEWDEL( Class, InitSize, GrowSize) \ - FixedMemPool Class::aPool( sizeof( Class ), (InitSize), (GrowSize) ); + FixedMemPool Class::aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) ); #define DECL_FIXEDMEMPOOL_NEWDEL_DLL( Class ) \ private: \ @@ -108,13 +113,13 @@ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) DECL_FIXEDMEMPOOL_DEL_DECL(); #define IMPL_FIXEDMEMPOOL_NEWDEL_DLL( Class, InitSize, GrowSize) \ - FixedMemPool Class::aPool( sizeof( Class ), (InitSize), (GrowSize) ); \ + FixedMemPool Class::aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) ); \ DECL_FIXEDMEMPOOL_NEW_IMPL( Class ) \ IMPL_FIXEDMEMPOOL_NEW_BODY( Class, aPool ) \ DECL_FIXEDMEMPOOL_DEL_IMPL( Class ) \ IMPL_FIXEDMEMPOOL_DEL_BODY( Class, aPool ) -#define INIT_FIXEDMEMPOOL_NEWDEL_DLL( class, aPool, InitSize, GrowSize ) \ - aPool( sizeof( class ), InitSize, GrowSize ) +#define INIT_FIXEDMEMPOOL_NEWDEL_DLL( Class, aPool, InitSize, GrowSize ) \ + aPool( IMPL_FIXEDMEMPOOL_STRING( Class ), sizeof( Class ), (InitSize), (GrowSize) ) #endif // _SVMEMPOOL_HXX diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx index 27054a3b79db..e8be417b15a2 100755 --- a/tools/source/memtools/mempool.cxx +++ b/tools/source/memtools/mempool.cxx @@ -28,7 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_tools.hxx" -#include <tools/mempool.hxx> +#include "tools/mempool.hxx" +#include "osl/diagnose.h" #include "rtl/alloc.h" #ifndef INCLUDED_STDIO_H @@ -42,11 +43,13 @@ *************************************************************************/ FixedMemPool::FixedMemPool ( - sal_uInt16 _nTypeSize, sal_uInt16, sal_uInt16) + char const * pTypeName, sal_uInt16 nTypeSize, sal_uInt16, sal_uInt16) + : m_pTypeName (pTypeName) { char name[RTL_CACHE_NAME_LENGTH + 1]; - snprintf (name, sizeof(name), "FixedMemPool_%d", (int)_nTypeSize); - m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, _nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0); + snprintf (name, sizeof(name), "FixedMemPool_%d", (int)nTypeSize); + m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0); + OSL_TRACE("FixedMemPool::ctor(\"%s\"): %p", m_pTypeName, m_pImpl); } /************************************************************************* @@ -57,7 +60,8 @@ FixedMemPool::FixedMemPool ( FixedMemPool::~FixedMemPool() { - rtl_cache_destroy ((rtl_cache_type*)(m_pImpl)); + OSL_TRACE("FixedMemPool::dtor(\"%s\"): %p", m_pTypeName, m_pImpl); + rtl_cache_destroy ((rtl_cache_type*)(m_pImpl)), m_pImpl = 0; } /************************************************************************* diff --git a/tools/workben/makefile.mk b/tools/workben/makefile.mk new file mode 100644 index 000000000000..d97156c7f66c --- /dev/null +++ b/tools/workben/makefile.mk @@ -0,0 +1,68 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = .. +PRJNAME = tools +TARGET = workben +LIBTARGET = NO +TARGETTYPE = CUI +ENABLE_EXCEPTIONS=TRUE + +.INCLUDE: settings.mk + +OBJFILES = \ + $(OBJ)$/solar.obj \ + $(OBJ)$/urltest.obj \ + $(OBJ)$/inetmimetest.obj \ + $(OBJ)$/mempooltest.obj + +APP1TARGET = solar +APP1OBJS = $(OBJ)$/solar.obj +.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2" +APP1STDLIBS = $(TOOLSLIB) +.ELSE +APP1LIBS = $(LB)$/itools.lib +.ENDIF + +APP2TARGET = urltest +APP2OBJS = $(OBJ)$/urltest.obj +.IF "$(GUI)" == "UNX" || "$(GUI)" == "OS2" +APP2STDLIBS = $(TOOLSLIB) $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) +.ELSE +APP2STDLIBS = $(LB)$/itools.lib $(VOSLIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) +.ENDIF + +APP3TARGET = inetmimetest +APP3OBJS = $(OBJ)$/inetmimetest.obj +APP3STDLIBS = $(SALLIB) $(TOOLSLIB) + +APP4TARGET = mempooltest +APP4OBJS = $(OBJ)$/mempooltest.obj +APP4STDLIBS = $(TOOLSLIB) +APP4RPATH = UREBIN + +.INCLUDE: target.mk diff --git a/tools/workben/mempooltest.cxx b/tools/workben/mempooltest.cxx new file mode 100644 index 000000000000..bf00343bc9d6 --- /dev/null +++ b/tools/workben/mempooltest.cxx @@ -0,0 +1,18 @@ +#include "tools/mempool.hxx" + +struct MempoolTest +{ + int m_int; + + DECL_FIXEDMEMPOOL_NEWDEL(MempoolTest); +}; + +IMPL_FIXEDMEMPOOL_NEWDEL(MempoolTest, 0, 0); + +int main() +{ + MempoolTest * p = new MempoolTest(); + if (p != 0) + delete p; + return 1; +} |