summaryrefslogtreecommitdiff
path: root/bridges/source
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2001-06-29 10:10:47 +0000
committerDaniel Boelzle <dbo@openoffice.org>2001-06-29 10:10:47 +0000
commitcf0cf8d73af9d0071500dfa98e26c55732cc4add (patch)
treed7e9e378091c996da8fd374a8edf9c52c3043b18 /bridges/source
parent824d65702a9946d3952ce57af1a288eaacc2bf1e (diff)
#88593# any opt: avoiding heap allocation for any sizeof(type) <= sizeof(void *)
Diffstat (limited to 'bridges/source')
-rw-r--r--bridges/source/remote/static/helper.cxx7
-rw-r--r--bridges/source/remote/urp/urp_unmarshal.cxx48
2 files changed, 48 insertions, 7 deletions
diff --git a/bridges/source/remote/static/helper.cxx b/bridges/source/remote/static/helper.cxx
index 7c3ace90a371..e18af5cb16f4 100644
--- a/bridges/source/remote/static/helper.cxx
+++ b/bridges/source/remote/static/helper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: helper.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jbu $ $Date: 2001-05-02 15:38:05 $
+ * last change: $Author: dbo $ $Date: 2001-06-29 11:10:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -209,8 +209,7 @@ void SAL_CALL remote_sendQueryInterface(
// set out parameter
if( typelib_TypeClass_INTERFACE == anyInterface.pType->eTypeClass )
{
- *ppRemoteI = *( remote_Interface ** ) anyInterface.pData;
- rtl_freeMemory( anyInterface.pData );
+ *ppRemoteI = ( remote_Interface * ) anyInterface.pReserved;
}
typelib_typedescriptionreference_release( anyInterface.pType );
}
diff --git a/bridges/source/remote/urp/urp_unmarshal.cxx b/bridges/source/remote/urp/urp_unmarshal.cxx
index 64b9ec1b732a..a4c440b70e90 100644
--- a/bridges/source/remote/urp/urp_unmarshal.cxx
+++ b/bridges/source/remote/urp/urp_unmarshal.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: urp_unmarshal.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $
+ * last change: $Author: dbo $ $Date: 2001-06-29 11:10:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -289,7 +289,49 @@ sal_Bool Unmarshal::unpackAny( void *pDest )
if( pType )
{
- pAny->pData = rtl_allocateMemory( pType->nSize );
+ switch (pType->eTypeClass)
+ {
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ if (sizeof(void *) < sizeof(sal_Int64))
+ {
+ pAny->pData = rtl_allocateMemory( sizeof(sal_Int64) );
+ }
+ else
+ {
+ pAny->pData = &pAny->pReserved;
+ }
+ break;
+ case typelib_TypeClass_FLOAT:
+ if (sizeof(void *) < sizeof(float))
+ {
+ pAny->pData = rtl_allocateMemory( sizeof(float) );
+ }
+ else
+ {
+ pAny->pData = &pAny->pReserved;
+ }
+ break;
+ case typelib_TypeClass_DOUBLE:
+ if (sizeof(void *) < sizeof(double))
+ {
+ pAny->pData = rtl_allocateMemory( sizeof(double) );
+ }
+ else
+ {
+ pAny->pData = &pAny->pReserved;
+ }
+ break;
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_UNION:
+ case typelib_TypeClass_EXCEPTION:
+ case typelib_TypeClass_ARRAY:
+ pAny->pData = rtl_allocateMemory( pType->nSize );
+ break;
+ default:
+ pAny->pData = &pAny->pReserved;
+ }
+
bReturn = unpack( pAny->pData , pType );
}
}