diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-24 16:32:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-27 08:47:38 +0200 |
commit | e6f4779de8fea16931967ce206439c5780d46125 (patch) | |
tree | dc898a89236247324e394815fe8bf821320c06c1 /sal/osl/unx | |
parent | afd49c198769b5e7fc01a68ce7a6847aa0d0ddd8 (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/osl/unx')
-rw-r--r-- | sal/osl/unx/file.cxx | 8 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 10 | ||||
-rw-r--r-- | sal/osl/unx/profile.cxx | 8 | ||||
-rw-r--r-- | sal/osl/unx/socket.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/thread.cxx | 6 |
5 files changed, 17 insertions, 17 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); } } |