summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-24 16:32:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-27 08:47:38 +0200
commite6f4779de8fea16931967ce206439c5780d46125 (patch)
treedc898a89236247324e394815fe8bf821320c06c1 /sal
parentafd49c198769b5e7fc01a68ce7a6847aa0d0ddd8 (diff)
directly use malloc/free in sal, instead of rtl_allocateMemory/etc
now that those functions are entirely malloc/free based, we can skip a function call layer. Change-Id: Ib091de0bdf4cdd58cee45185df17d96d3e8af402 Reviewed-on: https://gerrit.libreoffice.org/59576 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file.cxx8
-rw-r--r--sal/osl/unx/file_misc.cxx10
-rw-r--r--sal/osl/unx/profile.cxx8
-rw-r--r--sal/osl/unx/socket.cxx2
-rw-r--r--sal/osl/unx/thread.cxx6
-rw-r--r--sal/osl/w32/file.cxx8
-rw-r--r--sal/osl/w32/file_dirvol.cxx34
-rw-r--r--sal/osl/w32/file_url.cxx14
-rw-r--r--sal/osl/w32/path_helper.hxx4
-rw-r--r--sal/osl/w32/pipe.cxx10
-rw-r--r--sal/osl/w32/process.cxx4
-rw-r--r--sal/osl/w32/procimpl.cxx2
-rw-r--r--sal/osl/w32/socket.cxx12
-rw-r--r--sal/osl/w32/thread.cxx6
-rw-r--r--sal/rtl/bootstrap.cxx4
-rw-r--r--sal/rtl/byteseq.cxx18
-rw-r--r--sal/rtl/cipher.cxx4
-rw-r--r--sal/rtl/cmdargs.cxx2
-rw-r--r--sal/rtl/digest.cxx13
-rw-r--r--sal/rtl/locale.cxx26
-rw-r--r--sal/rtl/math.cxx4
-rw-r--r--sal/rtl/strimp.cxx10
-rw-r--r--sal/rtl/strimp.hxx2
23 files changed, 106 insertions, 105 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index ae221a8834a6..910345d74f28 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -186,7 +186,7 @@ FileHandle_Impl::FileHandle_Impl(int fd, enum Kind kind, char const * path)
if (pagesize != size_t(-1))
{
m_bufsiz = pagesize;
- m_buffer = static_cast<sal_uInt8 *>(rtl_allocateMemory(m_bufsiz));
+ m_buffer = static_cast<sal_uInt8 *>(malloc(m_bufsiz));
if (m_buffer)
memset(m_buffer, 0, m_bufsiz);
}
@@ -197,7 +197,7 @@ FileHandle_Impl::~FileHandle_Impl()
{
if (m_kind == KIND_FD)
{
- rtl_freeMemory(m_buffer);
+ free(m_buffer);
m_buffer = nullptr;
}
@@ -208,12 +208,12 @@ FileHandle_Impl::~FileHandle_Impl()
void* FileHandle_Impl::operator new (size_t n)
{
- return rtl_allocateMemory(n);
+ return malloc(n);
}
void FileHandle_Impl::operator delete (void * p)
{
- rtl_freeMemory(p);
+ free(p);
}
size_t FileHandle_Impl::getpagesize()
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 74712563311b..873bec3cb988 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -92,11 +92,11 @@ DirectoryItem_Impl::~DirectoryItem_Impl()
void * DirectoryItem_Impl::operator new(size_t n)
{
- return rtl_allocateMemory(n);
+ return malloc(n);
}
void DirectoryItem_Impl::operator delete(void * p)
{
- rtl_freeMemory(p);
+ free(p);
}
void DirectoryItem_Impl::acquire()
@@ -170,7 +170,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
if( pdir )
{
- oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*) rtl_allocateMemory( sizeof(oslDirectoryImpl) );
+ oslDirectoryImpl* pDirImpl = (oslDirectoryImpl*) malloc( sizeof(oslDirectoryImpl) );
if( pDirImpl )
{
@@ -197,7 +197,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
if( pdir )
{
/* create and initialize impl structure */
- oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(rtl_allocateMemory( sizeof(oslDirectoryImpl) ));
+ oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(malloc( sizeof(oslDirectoryImpl) ));
if( pDirImpl )
{
@@ -251,7 +251,7 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory)
/* cleanup members */
rtl_uString_release(pDirImpl->ustrPath);
- rtl_freeMemory(pDirImpl);
+ free(pDirImpl);
return err;
}
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index d103c4573d0a..4bd77901b247 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -1068,7 +1068,7 @@ static sal_Char* OslProfile_getLine(osl_TFile* pFile)
SAL_INFO("sal.osl", "read failed " << strerror(errno));
if( pLine )
- rtl_freeMemory( pLine );
+ free( pLine );
pLine = nullptr;
break;
}
@@ -1088,11 +1088,11 @@ static sal_Char* OslProfile_getLine(osl_TFile* pFile)
pChr++);
Max = pChr - pFile->m_pReadPtr;
- pNewLine = static_cast<sal_Char*>(rtl_allocateMemory( nLineBytes + Max + 1 ));
+ pNewLine = static_cast<sal_Char*>(malloc( nLineBytes + Max + 1 ));
if( pLine )
{
memcpy( pNewLine, pLine, nLineBytes );
- rtl_freeMemory( pLine );
+ free( pLine );
}
memcpy(pNewLine+nLineBytes, pFile->m_pReadPtr, Max);
nLineBytes += Max;
@@ -1546,7 +1546,7 @@ static bool loadProfile(osl_TFile* pFile, osl_TProfileImpl* pProfile)
while ( ( pLine=OslProfile_getLine(pFile) ) != nullptr )
{
sal_Char* bWasAdded = addLine( pProfile, pLine );
- rtl_freeMemory( pLine );
+ free( pLine );
SAL_WARN_IF(!bWasAdded, "sal.osl", "addLine( pProfile, pLine ) ==> false");
if ( ! bWasAdded )
return false;
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index c941f25658eb..edacf5f5e565 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -345,7 +345,7 @@ static oslSocketAddr createSocketAddrFromSystem( struct sockaddr *pSystemSockAdd
static void destroySocketAddr( oslSocketAddr addr )
{
- rtl_freeMemory( addr );
+ free( addr );
}
oslSocketAddr SAL_CALL osl_createEmptySocketAddr(oslAddrFamily Family)
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index affbc5c3fb9c..1cac41ce717b 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -964,7 +964,7 @@ struct wrapper_pthread_key
oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallback )
{
- wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(rtl_allocateMemory(sizeof(wrapper_pthread_key)));
+ wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(malloc(sizeof(wrapper_pthread_key)));
if (pKey)
{
@@ -972,7 +972,7 @@ oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallbac
if (pthread_key_create(&(pKey->m_key), pKey->pfnCallback) != 0)
{
- rtl_freeMemory(pKey);
+ free(pKey);
pKey = nullptr;
}
}
@@ -986,7 +986,7 @@ void SAL_CALL osl_destroyThreadKey(oslThreadKey Key)
if (pKey)
{
pthread_key_delete(pKey->m_key);
- rtl_freeMemory(pKey);
+ free(pKey);
}
}
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index e92c5a584c31..78dfaa046939 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -153,26 +153,26 @@ FileHandle_Impl::FileHandle_Impl(HANDLE hFile)
m_buffer (nullptr)
{
::InitializeCriticalSection (&m_mutex);
- m_buffer = static_cast<sal_uInt8 *>(rtl_allocateMemory(m_bufsiz));
+ m_buffer = static_cast<sal_uInt8 *>(malloc(m_bufsiz));
if (m_buffer)
memset (m_buffer, 0, m_bufsiz);
}
FileHandle_Impl::~FileHandle_Impl()
{
- rtl_freeMemory(m_buffer);
+ free(m_buffer);
m_buffer = nullptr;
::DeleteCriticalSection (&m_mutex);
}
void * FileHandle_Impl::operator new(size_t n)
{
- return rtl_allocateMemory(n);
+ return malloc(n);
}
void FileHandle_Impl::operator delete(void * p, size_t)
{
- rtl_freeMemory(p);
+ free(p);
}
SIZE_T FileHandle_Impl::getpagesize()
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index ef0f78491331..268c32a75dda 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -344,7 +344,7 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
nSuffLen = 3;
}
- WCHAR* szFileMask = static_cast< WCHAR* >( rtl_allocateMemory( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) );
+ WCHAR* szFileMask = static_cast< WCHAR* >( malloc( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) );
wcscpy( szFileMask, o3tl::toW(rtl_uString_getStr( pPath )) );
wcscat( szFileMask, pSuffix );
@@ -360,7 +360,7 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
pDirectory = nullptr;
}
}
- rtl_freeMemory(szFileMask);
+ free(szFileMask);
}
}
@@ -436,7 +436,7 @@ static oslFileError osl_openLocalRoot(
{
Directory_Impl *pDirImpl;
- pDirImpl = static_cast<Directory_Impl*>(rtl_allocateMemory( sizeof(Directory_Impl)));
+ pDirImpl = static_cast<Directory_Impl*>(malloc( sizeof(Directory_Impl)));
ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strSysPath );
@@ -479,7 +479,7 @@ static oslFileError osl_openLocalRoot(
pDirImpl->m_pDirectoryPath = nullptr;
}
- rtl_freeMemory(pDirImpl);
+ free(pDirImpl);
pDirImpl = nullptr;
}
@@ -500,7 +500,7 @@ static oslFileError osl_openFileDirectory(
return osl_File_E_INVAL;
*pDirectory = nullptr;
- Directory_Impl *pDirImpl = static_cast<Directory_Impl*>(rtl_allocateMemory(sizeof(Directory_Impl)));
+ Directory_Impl *pDirImpl = static_cast<Directory_Impl*>(malloc(sizeof(Directory_Impl)));
ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strDirectoryPath );
@@ -535,7 +535,7 @@ static oslFileError osl_openFileDirectory(
pDirImpl->m_pDirectoryPath = nullptr;
}
- rtl_freeMemory(pDirImpl);
+ free(pDirImpl);
pDirImpl = nullptr;
}
@@ -565,7 +565,7 @@ static oslFileError osl_openNetworkServer(
{
Directory_Impl *pDirImpl;
- pDirImpl = static_cast<Directory_Impl*>(rtl_allocateMemory(sizeof(Directory_Impl)));
+ pDirImpl = static_cast<Directory_Impl*>(malloc(sizeof(Directory_Impl)));
ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
pDirImpl->uType = DIRECTORYTYPE_NETROOT;
pDirImpl->hDirectory = hEnum;
@@ -783,7 +783,7 @@ static oslFileError osl_getNextNetResource(
case NO_ERROR:
case ERROR_MORE_DATA:
{
- pItemImpl = static_cast<DirectoryItem_Impl*>(rtl_allocateMemory(sizeof(DirectoryItem_Impl)));
+ pItemImpl = static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
if ( !pItemImpl )
return osl_File_E_NOMEM;
@@ -817,7 +817,7 @@ static oslFileError osl_getNextDrive(
if ( !pDirImpl )
return osl_File_E_INVAL;
- pItemImpl = static_cast<DirectoryItem_Impl*>(rtl_allocateMemory(sizeof(DirectoryItem_Impl)));
+ pItemImpl = static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
if ( !pItemImpl )
return osl_File_E_NOMEM;
@@ -839,7 +839,7 @@ static oslFileError osl_getNextDrive(
pItemImpl->m_pFullPath = nullptr;
}
- rtl_freeMemory( pItemImpl );
+ free( pItemImpl );
return oslTranslateFileError( GetLastError() );
}
}
@@ -858,7 +858,7 @@ static oslFileError osl_getNextFileItem(
if ( !pDirImpl )
return osl_File_E_INVAL;
- pItemImpl = static_cast<DirectoryItem_Impl*>(rtl_allocateMemory(sizeof(DirectoryItem_Impl)));
+ pItemImpl = static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
if ( !pItemImpl )
return osl_File_E_NOMEM;
@@ -887,7 +887,7 @@ static oslFileError osl_getNextFileItem(
pItemImpl->m_pFullPath = nullptr;
}
- rtl_freeMemory( pItemImpl );
+ free( pItemImpl );
return oslTranslateFileError( GetLastError() );
}
}
@@ -951,7 +951,7 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory Directory)
pDirImpl->m_pDirectoryPath = nullptr;
}
- rtl_freeMemory(pDirImpl);
+ free(pDirImpl);
}
return eError;
}
@@ -999,7 +999,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
case PATHTYPE_NETSERVER:
{
DirectoryItem_Impl* pItemImpl =
- static_cast<DirectoryItem_Impl*>(rtl_allocateMemory(sizeof(DirectoryItem_Impl)));
+ static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
if ( !pItemImpl )
error = osl_File_E_NOMEM;
@@ -1030,7 +1030,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
case PATHTYPE_VOLUME:
{
DirectoryItem_Impl* pItemImpl =
- static_cast<DirectoryItem_Impl*>(rtl_allocateMemory(sizeof(DirectoryItem_Impl)));
+ static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
if ( !pItemImpl )
error = osl_File_E_NOMEM;
@@ -1067,7 +1067,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
if ( hFind != INVALID_HANDLE_VALUE )
{
DirectoryItem_Impl *pItemImpl =
- static_cast<DirectoryItem_Impl*>(rtl_allocateMemory(sizeof(DirectoryItem_Impl)));
+ static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
ZeroMemory( pItemImpl, sizeof(DirectoryItem_Impl) );
osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) );
@@ -1120,7 +1120,7 @@ oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item )
pItemImpl->m_pFullPath = nullptr;
}
- rtl_freeMemory( pItemImpl );
+ free( pItemImpl );
}
return osl_File_E_None;
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index 6cdb140aa22d..82260c85ef07 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -493,7 +493,7 @@ static bool osl_decodeURL_( rtl_String* strUTF8, rtl_uString** pstrDecodedURL )
/* The resulting decoded string length is shorter or equal to the source length */
nSrcLen = rtl_string_getLength(strUTF8);
- pBuffer = static_cast<sal_Char*>(rtl_allocateMemory((nSrcLen + 1) * sizeof(sal_Char)));
+ pBuffer = static_cast<sal_Char*>(malloc((nSrcLen + 1) * sizeof(sal_Char)));
pDest = pBuffer;
pSrc = rtl_string_getStr(strUTF8);
@@ -543,7 +543,7 @@ static bool osl_decodeURL_( rtl_String* strUTF8, rtl_uString** pstrDecodedURL )
OSL_ASSERT(*pstrDecodedURL != nullptr);
}
- rtl_freeMemory( pBuffer );
+ free( pBuffer );
return bValidEncoded;
}
@@ -561,7 +561,7 @@ static void osl_encodeURL_( rtl_uString *strURL, rtl_String **pstrEncodedURL )
rtl_uString2String( &strUTF8, rtl_uString_getStr( strURL ), rtl_uString_getLength( strURL ), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS );
- pszEncodedURL = static_cast<sal_Char*>(rtl_allocateMemory( (rtl_string_getLength( strUTF8 ) * 3 + 1) * sizeof(sal_Char) ));
+ pszEncodedURL = static_cast<sal_Char*>(malloc( (rtl_string_getLength( strUTF8 ) * 3 + 1) * sizeof(sal_Char) ));
pURLDest = pszEncodedURL;
pURLScan = rtl_string_getStr( strUTF8 );
@@ -614,7 +614,7 @@ static void osl_encodeURL_( rtl_uString *strURL, rtl_String **pstrEncodedURL )
rtl_string_release( strUTF8 );
rtl_string_newFromStr( pstrEncodedURL, pszEncodedURL );
- rtl_freeMemory( pszEncodedURL );
+ free( pszEncodedURL );
}
oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **pustrPath, bool bAllowRelative )
@@ -903,8 +903,8 @@ oslFileError SAL_CALL osl_searchFileURL(
/* +1 is not necessary if we follow MSDN documentation but for robustness we do so */
nBufferLength = dwResult + 1;
lpBuffer = lpBuffer ?
- static_cast<LPWSTR>(rtl_reallocateMemory(lpBuffer, nBufferLength * sizeof(WCHAR))) :
- static_cast<LPWSTR>(rtl_allocateMemory(nBufferLength * sizeof(WCHAR)));
+ static_cast<LPWSTR>(realloc(lpBuffer, nBufferLength * sizeof(WCHAR))) :
+ static_cast<LPWSTR>(malloc(nBufferLength * sizeof(WCHAR)));
dwResult = SearchPathW( lpszSearchPath, lpszSearchFile, nullptr, nBufferLength, lpBuffer, &lpszFilePart );
} while ( dwResult && dwResult >= nBufferLength );
@@ -934,7 +934,7 @@ oslFileError SAL_CALL osl_searchFileURL(
}
}
- rtl_freeMemory( lpBuffer );
+ free( lpBuffer );
}
if ( ustrSysPath )
diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx
index 0210791f401f..237c130f7fd8 100644
--- a/sal/osl/w32/path_helper.hxx
+++ b/sal/osl/w32/path_helper.hxx
@@ -93,7 +93,7 @@ class LongPathBuffer
public:
explicit LongPathBuffer( sal_uInt32 nCharNum )
- : m_pBuffer( static_cast<T*>( rtl_allocateMemory( nCharNum * sizeof( T ) ) ) )
+ : m_pBuffer( static_cast<T*>( malloc( nCharNum * sizeof( T ) ) ) )
, m_nCharNum( nCharNum )
{
OSL_ENSURE( m_pBuffer, "Can not allocate the buffer!" );
@@ -102,7 +102,7 @@ public:
~LongPathBuffer()
{
if ( m_pBuffer )
- rtl_freeMemory( m_pBuffer );
+ free( m_pBuffer );
m_pBuffer = nullptr;
}
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index 116bdd3d6817..92ec4f918354 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -87,8 +87,8 @@ void osl_destroyPipeImpl(oslPipe pPipe)
if (pPipe->m_Security)
{
- rtl_freeMemory(pPipe->m_Security->lpSecurityDescriptor);
- rtl_freeMemory(pPipe->m_Security);
+ free(pPipe->m_Security->lpSecurityDescriptor);
+ free(pPipe->m_Security);
}
CloseHandle(pPipe->m_ReadEvent);
@@ -98,7 +98,7 @@ void osl_destroyPipeImpl(oslPipe pPipe)
if (pPipe->m_Name)
rtl_uString_release(pPipe->m_Name);
- rtl_freeMemory(pPipe);
+ free(pPipe);
}
}
@@ -135,13 +135,13 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
{
PSECURITY_DESCRIPTOR pSecDesc;
- pSecDesc = static_cast< PSECURITY_DESCRIPTOR >(rtl_allocateMemory(SECURITY_DESCRIPTOR_MIN_LENGTH));
+ pSecDesc = static_cast< PSECURITY_DESCRIPTOR >(malloc(SECURITY_DESCRIPTOR_MIN_LENGTH));
/* add a NULL disc. ACL to the security descriptor */
OSL_VERIFY(InitializeSecurityDescriptor(pSecDesc, SECURITY_DESCRIPTOR_REVISION));
OSL_VERIFY(SetSecurityDescriptorDacl(pSecDesc, TRUE, nullptr, FALSE));
- pSecAttr = static_cast< PSECURITY_ATTRIBUTES >(rtl_allocateMemory(sizeof(SECURITY_ATTRIBUTES)));
+ pSecAttr = static_cast< PSECURITY_ATTRIBUTES >(malloc(sizeof(SECURITY_ATTRIBUTES)));
pSecAttr->nLength = sizeof(SECURITY_ATTRIBUTES);
pSecAttr->lpSecurityDescriptor = pSecDesc;
pSecAttr->bInheritHandle = TRUE;
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 92d61b93ada9..f1e223bd34cd 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -147,7 +147,7 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident)
if (hProcess)
{
- pProcImpl = static_cast< oslProcessImpl*>( rtl_allocateMemory(sizeof(oslProcessImpl)) );
+ pProcImpl = static_cast< oslProcessImpl*>( malloc(sizeof(oslProcessImpl)) );
pProcImpl->m_hProcess = hProcess;
pProcImpl->m_IdProcess = Ident;
}
@@ -163,7 +163,7 @@ void SAL_CALL osl_freeProcessHandle(oslProcess Process)
{
CloseHandle(static_cast<oslProcessImpl*>(Process)->m_hProcess);
- rtl_freeMemory(Process);
+ free(Process);
}
}
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index b65a942cb9d4..a2e4021f0f1f 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -546,7 +546,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
CloseHandle(process_info.hThread);
oslProcessImpl* pProcImpl = static_cast<oslProcessImpl*>(
- rtl_allocateMemory(sizeof(oslProcessImpl)));
+ malloc(sizeof(oslProcessImpl)));
if (pProcImpl != nullptr)
{
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 6d9be8dd2930..e25e35cbdc24 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -236,7 +236,7 @@ void destroySocketImpl(oslSocketImpl *pImpl)
{
if (pImpl)
{
- rtl_freeMemory (pImpl);
+ free (pImpl);
}
}
@@ -285,7 +285,7 @@ static void destroySocketAddr( oslSocketAddr addr )
#if OSL_DEBUG_LEVEL > 0
g_nSocketAddr --;
#endif
- rtl_freeMemory( addr );
+ free( addr );
}
oslSocketAddr SAL_CALL osl_createEmptySocketAddr(oslAddrFamily Family)
@@ -475,7 +475,7 @@ oslHostAddr SAL_CALL osl_createHostAddr (
return nullptr;
}
- pAddr= static_cast<oslHostAddr>(rtl_allocateMemory (sizeof (struct oslHostAddrImpl)));
+ pAddr= static_cast<oslHostAddr>(malloc (sizeof (struct oslHostAddrImpl)));
if (pAddr == nullptr)
{
@@ -595,7 +595,7 @@ void SAL_CALL osl_destroyHostAddr(oslHostAddr pAddr)
if (pAddr->pSockAddr)
osl_destroySocketAddr( pAddr->pSockAddr );
- rtl_freeMemory (pAddr);
+ free (pAddr);
}
}
@@ -1623,7 +1623,7 @@ oslSocketSet SAL_CALL osl_createSocketSet()
{
oslSocketSetImpl* pSet;
- pSet = static_cast<oslSocketSetImpl*>(rtl_allocateMemory(sizeof(oslSocketSetImpl)));
+ pSet = static_cast<oslSocketSetImpl*>(malloc(sizeof(oslSocketSetImpl)));
if(pSet)
{
@@ -1636,7 +1636,7 @@ oslSocketSet SAL_CALL osl_createSocketSet()
void SAL_CALL osl_destroySocketSet (oslSocketSet Set)
{
if(Set)
- rtl_freeMemory(Set);
+ free(Set);
}
void SAL_CALL osl_clearSocketSet (oslSocketSet Set)
diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx
index 716e299f2a50..a0f46b7e5229 100644
--- a/sal/osl/w32/thread.cxx
+++ b/sal/osl/w32/thread.cxx
@@ -448,14 +448,14 @@ void osl_callThreadKeyCallbackOnThreadDetach(void)
oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback)
{
- PTLS pTls = static_cast<PTLS>(rtl_allocateMemory( sizeof(TLS) ));
+ PTLS pTls = static_cast<PTLS>(malloc( sizeof(TLS) ));
if ( pTls )
{
pTls->pfnCallback = pCallback;
if ( DWORD(-1) == (pTls->dwIndex = TlsAlloc()) )
{
- rtl_freeMemory( pTls );
+ free( pTls );
pTls = nullptr;
}
else
@@ -473,7 +473,7 @@ void SAL_CALL osl_destroyThreadKey(oslThreadKey Key)
RemoveKeyFromList( pTls );
TlsFree( pTls->dwIndex );
- rtl_freeMemory( pTls );
+ free( pTls );
}
}
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index a802da6a562c..ac735caf713b 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -320,9 +320,9 @@ struct Bootstrap_Impl
~Bootstrap_Impl();
static void * operator new (std::size_t n)
- { return rtl_allocateMemory (sal_uInt32(n)); }
+ { return malloc (sal_uInt32(n)); }
static void operator delete (void * p , std::size_t)
- { rtl_freeMemory (p); }
+ { free (p); }
bool getValue(
rtl::OUString const & key, rtl_uString ** value,
diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx
index d0c77b5dc1ed..64f815b4d73b 100644
--- a/sal/rtl/byteseq.cxx
+++ b/sal/rtl/byteseq.cxx
@@ -19,12 +19,12 @@
#include <assert.h>
#include <string.h>
+#include <stdlib.h>
#include <osl/diagnose.h>
#include <osl/interlck.h>
#include <rtl/byteseq.h>
-#include <rtl/alloc.h>
/* static data to be referenced by all empty strings
* the refCount is predefined to 1 and must never become 0 !
@@ -50,17 +50,17 @@ void SAL_CALL rtl_byte_sequence_reference2One(
nElements = pSequence->nElements;
if (nElements)
{
- pNew = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nElements ));
+ pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nElements ));
if ( pNew != nullptr )
memcpy( pNew->elements, pSequence->elements, nElements );
if (! osl_atomic_decrement( &pSequence->nRefCount ))
- rtl_freeMemory( pSequence );
+ free( pSequence );
}
else
{
- pNew = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE ));
+ pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE ));
}
if ( pNew != nullptr )
@@ -88,7 +88,7 @@ void SAL_CALL rtl_byte_sequence_realloc(
if (pSequence->nRefCount > 1) // split
{
- pNew = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nSize ));
+ pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nSize ));
if ( pNew != nullptr )
{
@@ -104,12 +104,12 @@ void SAL_CALL rtl_byte_sequence_realloc(
}
if (! osl_atomic_decrement( &pSequence->nRefCount ))
- rtl_freeMemory( pSequence );
+ free( pSequence );
pSequence = pNew;
}
else
{
- pSequence = static_cast<sal_Sequence *>(rtl_reallocateMemory(
+ pSequence = static_cast<sal_Sequence *>(realloc(
pSequence, SAL_SEQUENCE_HEADER_SIZE + nSize ));
}
@@ -136,7 +136,7 @@ void SAL_CALL rtl_byte_sequence_release( sal_Sequence *pSequence )
{
if (! osl_atomic_decrement( &(pSequence->nRefCount )) )
{
- rtl_freeMemory( pSequence );
+ free( pSequence );
}
}
}
@@ -178,7 +178,7 @@ void SAL_CALL rtl_byte_sequence_constructNoDefault( sal_Sequence **ppSequence ,
*ppSequence = nullptr;
}
- *ppSequence = static_cast<sal_Sequence *>(rtl_allocateMemory( SAL_SEQUENCE_HEADER_SIZE + nLength ));
+ *ppSequence = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nLength ));
if ( *ppSequence != nullptr )
{
diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx
index 96cb896623e1..3041d865b7b0 100644
--- a/sal/rtl/cipher.cxx
+++ b/sal/rtl/cipher.cxx
@@ -1138,7 +1138,7 @@ void SAL_CALL rtl_cipher_destroyBF(rtlCipher Cipher) SAL_THROW_EXTERN_C()
rtl_freeZeroMemory(pImpl, sizeof(CipherBF_Impl));
}
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
@@ -1409,7 +1409,7 @@ void SAL_CALL rtl_cipher_destroyARCFOUR(rtlCipher Cipher) SAL_THROW_EXTERN_C()
rtl_freeZeroMemory(pImpl, sizeof(CipherARCFOUR_Impl));
}
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx
index 8e10b0bca04d..3c3069f4fd6a 100644
--- a/sal/rtl/cmdargs.cxx
+++ b/sal/rtl/cmdargs.cxx
@@ -37,7 +37,7 @@ ArgHolder::~ArgHolder()
while (g_nCommandArgCount > 0)
rtl_uString_release (g_ppCommandArgs[--g_nCommandArgCount]);
- rtl_freeMemory (g_ppCommandArgs);
+ free (g_ppCommandArgs);
g_ppCommandArgs = nullptr;
}
diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx
index fbacbc9838dd..3bd2dfa214dd 100644
--- a/sal/rtl/digest.cxx
+++ b/sal/rtl/digest.cxx
@@ -18,6 +18,7 @@
*/
#include <string.h>
+#include <stdlib.h>
#include <sal/types.h>
#include <osl/endian.h>
@@ -430,7 +431,7 @@ void SAL_CALL rtl_digest_destroyMD2(rtlDigest Digest) SAL_THROW_EXTERN_C()
if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD2)
rtl_freeZeroMemory(pImpl, sizeof(DigestMD2_Impl));
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
@@ -813,7 +814,7 @@ void SAL_CALL rtl_digest_destroyMD5(rtlDigest Digest) SAL_THROW_EXTERN_C()
if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD5)
rtl_freeZeroMemory(pImpl, sizeof(DigestMD5_Impl));
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
@@ -1227,7 +1228,7 @@ void SAL_CALL rtl_digest_destroySHA(rtlDigest Digest) SAL_THROW_EXTERN_C()
if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmSHA)
rtl_freeZeroMemory(pImpl, sizeof(DigestSHA_Impl));
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
@@ -1387,7 +1388,7 @@ void SAL_CALL rtl_digest_destroySHA1(rtlDigest Digest) SAL_THROW_EXTERN_C()
if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmSHA1)
rtl_freeZeroMemory(pImpl, sizeof(DigestSHA_Impl));
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
@@ -1584,7 +1585,7 @@ void SAL_CALL rtl_digest_destroyHMAC_MD5(rtlDigest Digest) SAL_THROW_EXTERN_C()
if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmHMAC_MD5)
rtl_freeZeroMemory(pImpl, sizeof(DigestHMAC_MD5_Impl));
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
@@ -1781,7 +1782,7 @@ void SAL_CALL rtl_digest_destroyHMAC_SHA1(rtlDigest Digest)
if (pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmHMAC_SHA1)
rtl_freeZeroMemory(pImpl, sizeof(DigestHMAC_SHA1_Impl));
else
- rtl_freeMemory(pImpl);
+ free(pImpl);
}
}
diff --git a/sal/rtl/locale.cxx b/sal/rtl/locale.cxx
index b6b5ee499141..3fb85e1b8bb7 100644
--- a/sal/rtl/locale.cxx
+++ b/sal/rtl/locale.cxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <stdlib.h>
#include <rtl/locale.h>
#include <osl/diagnose.h>
-#include <rtl/alloc.h>
#include <rtllifecycle.h>
@@ -56,8 +56,8 @@ extern "C" void rtl_hashentry_destroy(RTL_HASHENTRY* entry)
if (entry->Next)
rtl_hashentry_destroy(entry->Next);
- rtl_freeMemory(entry->Entry);
- rtl_freeMemory(entry);
+ free(entry->Entry);
+ free(entry);
}
extern "C" void rtl_hashtable_destroy(RTL_HASHTABLE* table)
@@ -77,8 +77,8 @@ extern "C" void rtl_hashtable_destroy(RTL_HASHTABLE* table)
size--;
}
- rtl_freeMemory(table->Table);
- rtl_freeMemory(table);
+ free(table->Table);
+ free(table);
}
extern "C" void rtl_hashtable_init(RTL_HASHTABLE** table, sal_Int8 sizeIndex)
@@ -88,12 +88,12 @@ extern "C" void rtl_hashtable_init(RTL_HASHTABLE** table, sal_Int8 sizeIndex)
if (*table)
rtl_hashtable_destroy(*table);
- *table = static_cast< RTL_HASHTABLE* >(rtl_allocateMemory(sizeof(RTL_HASHTABLE)));
+ *table = static_cast< RTL_HASHTABLE* >(malloc(sizeof(RTL_HASHTABLE)));
(*table)->iSize = sizeIndex;
(*table)->Size = nSize;
(*table)->Elements = 0;
- (*table)->Table = static_cast< RTL_HASHENTRY** >(rtl_allocateMemory((*table)->Size * sizeof(RTL_HASHENTRY*)));
+ (*table)->Table = static_cast< RTL_HASHENTRY** >(malloc((*table)->Size * sizeof(RTL_HASHENTRY*)));
while (nSize)
{
@@ -130,7 +130,7 @@ extern "C" rtl_Locale* rtl_hashtable_add(RTL_HASHTABLE** table, rtl_Locale* valu
pEntry = &(*pEntry)->Next;
}
- RTL_HASHENTRY *newEntry = static_cast< RTL_HASHENTRY* >(rtl_allocateMemory(sizeof(RTL_HASHENTRY)));
+ RTL_HASHENTRY *newEntry = static_cast< RTL_HASHENTRY* >(malloc(sizeof(RTL_HASHENTRY)));
newEntry->Entry = value;
newEntry->Next = nullptr;
*pEntry = newEntry;
@@ -158,18 +158,18 @@ sal_Bool rtl_hashtable_grow(RTL_HASHTABLE** table)
{
rtl_hashtable_add(&pNewTable, pEntry->Next->Entry);
pNext = pEntry->Next;
- rtl_freeMemory(pEntry);
+ free(pEntry);
pEntry = pNext;
}
- rtl_freeMemory(pEntry);
+ free(pEntry);
}
i++;
}
- rtl_freeMemory((*table)->Table);
- rtl_freeMemory(*table);
+ free((*table)->Table);
+ free(*table);
(*table) = pNewTable;
return true;
@@ -247,7 +247,7 @@ rtl_Locale * SAL_CALL rtl_locale_register(const sal_Unicode * language, const sa
rtl_uString_newFromStr(&sCountry, country);
rtl_uString_newFromStr(&sVariant, variant);
- newLocale = static_cast<rtl_Locale*>(rtl_allocateMemory( sizeof(rtl_Locale) ));
+ newLocale = static_cast<rtl_Locale*>(malloc( sizeof(rtl_Locale) ));
newLocale->Language = sLanguage;
newLocale->Country = sCountry;
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 7b172f1ee1d2..12571baf4b86 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -464,7 +464,7 @@ inline void doubleToString(typename T::String ** pResult,
if (nBuf > nBufMax)
{
pBuf = static_cast< typename T::Char * >(
- rtl_allocateMemory(nBuf * sizeof (typename T::Char)));
+ malloc(nBuf * sizeof (typename T::Char)));
OSL_ENSURE(pBuf, "Out of memory");
}
else
@@ -707,7 +707,7 @@ inline void doubleToString(typename T::String ** pResult,
T::appendChars(pResult, pResultCapacity, &nResultOffset, pBuf, p - pBuf);
if (pBuf != &aBuf[0])
- rtl_freeMemory(pBuf);
+ free(pBuf);
}
}
diff --git a/sal/rtl/strimp.cxx b/sal/rtl/strimp.cxx
index d1651a2ad1d7..51a1a94bd705 100644
--- a/sal/rtl/strimp.cxx
+++ b/sal/rtl/strimp.cxx
@@ -65,11 +65,11 @@ bool rtl_ImplIsWhitespace( sal_Unicode c )
*/
static rtl_arena_type *pre_arena = nullptr;
-rtl_allocateStringFn rtl_allocateString = rtl_allocateMemory;
-rtl_freeStringFn rtl_freeString = rtl_freeMemory;
+rtl_allocateStringFn rtl_allocateString = malloc;
+rtl_freeStringFn rtl_freeString = free;
extern "C" {
-static void *pre_allocateStringFn(sal_Size n)
+static void *pre_allocateStringFn(size_t n)
{
sal_Size size = RTL_MEMORY_ALIGN(n + 4, 4);
char *addr = static_cast<char*>(rtl_arena_alloc(pre_arena, &size));
@@ -110,8 +110,8 @@ void SAL_CALL rtl_alloc_preInit (sal_Bool start) SAL_THROW_EXTERN_C()
else
{
rtl_arena_foreach(pre_arena, mark_static);
- rtl_allocateString = rtl_allocateMemory;
- rtl_freeString = rtl_freeMemory;
+ rtl_allocateString = malloc;
+ rtl_freeString = free;
// TODO: also re-initialize main allocator as well.
}
diff --git a/sal/rtl/strimp.hxx b/sal/rtl/strimp.hxx
index b3446db1fdb2..f3516f7999bd 100644
--- a/sal/rtl/strimp.hxx
+++ b/sal/rtl/strimp.hxx
@@ -56,7 +56,7 @@ rtl_String* rtl_string_ImplAlloc( sal_Int32 nLen );
extern "C" {
-typedef void *(*rtl_allocateStringFn)(sal_Size size);
+typedef void *(SAL_CALL * rtl_allocateStringFn)(size_t size);
typedef void (*rtl_freeStringFn)(void *);
}