merge the formfield patch from ooo-build
[ooovba.git] / tools / source / memtools / mempool.cxx
blob03a74b84d881a2cd53c071ce15a881bfe52bc706
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mempool.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_tools.hxx"
34 #include <tools/mempool.hxx>
35 #include "rtl/alloc.h"
37 #ifndef INCLUDED_STDIO_H
38 #include <stdio.h>
39 #endif
41 /*************************************************************************
43 |* FixedMemPool::FixedMemPool()
45 *************************************************************************/
47 FixedMemPool::FixedMemPool (
48 USHORT _nTypeSize, USHORT, USHORT)
50 char name[RTL_CACHE_NAME_LENGTH + 1];
51 snprintf (name, sizeof(name), "FixedMemPool_%d", (int)_nTypeSize);
52 m_pImpl = (FixedMemPool_Impl*)rtl_cache_create (name, _nTypeSize, 0, NULL, NULL, NULL, 0, NULL, 0);
55 /*************************************************************************
57 |* FixedMemPool::~FixedMemPool()
59 *************************************************************************/
61 FixedMemPool::~FixedMemPool()
63 rtl_cache_destroy ((rtl_cache_type*)(m_pImpl));
66 /*************************************************************************
68 |* FixedMemPool::Alloc()
70 *************************************************************************/
72 void* FixedMemPool::Alloc()
74 return rtl_cache_alloc ((rtl_cache_type*)(m_pImpl));
77 /*************************************************************************
79 |* FixedMemPool::Free()
81 *************************************************************************/
83 void FixedMemPool::Free( void* pFree )
85 rtl_cache_free ((rtl_cache_type*)(m_pImpl), pFree);