diff options
author | Matthias Huetsch <mhu@openoffice.org> | 2002-08-17 16:29:04 +0000 |
---|---|---|
committer | Matthias Huetsch <mhu@openoffice.org> | 2002-08-17 16:29:04 +0000 |
commit | a8f4de3fd9060a6779bf6e5dfd8431e4aa1c95e3 (patch) | |
tree | b0ed50862002f3f644d6628ff6760658811f1288 /store | |
parent | 0925d31a72021827d5c77377cf8b111681400ec8 (diff) |
#i3980# Added class specific allocators to 'OStorePageCache' and
'OStorePageCacheEntry' to avoid mix with standard allocators.
Minor code cleanup.
Diffstat (limited to 'store')
-rw-r--r-- | store/source/storcach.cxx | 57 | ||||
-rw-r--r-- | store/source/storcach.hxx | 16 |
2 files changed, 49 insertions, 24 deletions
diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx index 6e717b0312b0..e41e36048772 100644 --- a/store/source/storcach.cxx +++ b/store/source/storcach.cxx @@ -2,9 +2,9 @@ * * $RCSfile: storcach.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mhu $ $Date: 2001-11-26 21:20:36 $ + * last change: $Author: mhu $ $Date: 2002-08-17 17:29:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,14 +59,14 @@ * ************************************************************************/ -#define _STORE_STORCACH_CXX "$Revision: 1.3 $" +#define _STORE_STORCACH_CXX "$Revision: 1.4 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> #endif -#ifndef _RTL_MEMORY_H_ -#include <rtl/memory.h> +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> #endif #ifndef _OSL_DIAGNOSE_H_ @@ -87,21 +87,12 @@ #include <storcach.hxx> #endif -using namespace store; +#ifndef INCLUDED_CSTDDEF +#include <cstddef> +#define INCLUDED_CSTDDEF +#endif -/*======================================================================== - * - * OStorePageCache internals. - * - *======================================================================*/ -/* - * __store_memcpy. - */ -#include <string.h> -inline void __store_memcpy (void *dst, const void *src, sal_uInt32 n) -{ - ::memcpy (dst, src, n); -} +using namespace store; /*======================================================================== * @@ -124,6 +115,17 @@ struct OStorePageCacheEntry self *m_pNext; self *m_pPrev; + /** Allocation. + */ + static void * operator new (std::size_t n) SAL_THROW(()) + { + return rtl_allocateMemory (sal_uInt32(n)); + } + static void operator delete (void * p, std::size_t) SAL_THROW(()) + { + rtl_freeMemory (p); + } + /** Construction. */ OStorePageCacheEntry (const D& rDescr, const data& rData) @@ -305,6 +307,19 @@ static sal_uInt16 __store_find_entry ( * *======================================================================*/ /* + * Allocation. + */ +void * OStorePageCache::operator new (std::size_t n) SAL_THROW(()) +{ + return rtl_allocateMemory (sal_uInt32(n)); +} + +void OStorePageCache::operator delete (void * p, std::size_t) SAL_THROW(()) +{ + rtl_freeMemory (p); +} + +/* * OStorePageCache. */ OStorePageCache::OStorePageCache (sal_uInt16 nPages) @@ -370,7 +385,7 @@ void OStorePageCache::move (sal_uInt16 nSI, sal_uInt16 nDI) if (nSI < nDI) { // shift left. - rtl_moveMemory ( + __store_memmove ( &m_pData[nSI ], &m_pData[nSI + 1], (nDI - nSI) * sizeof(entry*)); @@ -382,7 +397,7 @@ void OStorePageCache::move (sal_uInt16 nSI, sal_uInt16 nDI) if (nSI > nDI) { // shift right. - rtl_moveMemory ( + __store_memmove ( &m_pData[nDI + 1], &m_pData[nDI ], (nSI - nDI) * sizeof(entry*)); diff --git a/store/source/storcach.hxx b/store/source/storcach.hxx index 3ec0baede713..aae88679bdf3 100644 --- a/store/source/storcach.hxx +++ b/store/source/storcach.hxx @@ -2,9 +2,9 @@ * * $RCSfile: storcach.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mhu $ $Date: 2001-03-13 20:54:25 $ + * last change: $Author: mhu $ $Date: 2002-08-17 17:29:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,7 +60,7 @@ ************************************************************************/ #ifndef _STORE_STORCACH_HXX -#define _STORE_STORCACH_HXX "$Revision: 1.2 $" +#define _STORE_STORCACH_HXX "$Revision: 1.3 $" #ifndef _SAL_TYPES_H_ #include <sal/types.h> @@ -74,6 +74,11 @@ #include <store/types.h> #endif +#ifndef INCLUDED_CSTDDEF +#include <cstddef> +#define INCLUDED_CSTDDEF +#endif + namespace store { @@ -97,6 +102,11 @@ class OStorePageCache typedef OStorePageCacheEntry entry; public: + /** Allocation. + */ + static void * operator new (std::size_t n) SAL_THROW(()); + static void operator delete (void * p, std::size_t) SAL_THROW(()); + /** Construction. */ OStorePageCache ( |