summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-20 08:52:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-20 09:51:42 +0200
commit05f67637fc4f71750dda46fccf0bed5b3fd99233 (patch)
treec5221d056688a87607ffe9e86521a606eb7fa956 /sal
parent67a0889450daa6b9c9c799dab2d9da3a5044cb5d (diff)
new cannot return nullptr
unless we are using std::nothrow Change-Id: I3bdd13c8ce18f4e977f18ee5196311bf4fc62de0 Reviewed-on: https://gerrit.libreoffice.org/38998 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file.cxx13
-rw-r--r--sal/osl/unx/thread.cxx9
-rw-r--r--sal/osl/w32/file.cxx6
3 files changed, 3 insertions, 25 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 9d7b31d3a7d4..333d2459b351 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -734,8 +734,6 @@ oslFileHandle osl::detail::createFileHandleFromFD( int fd )
return nullptr; // EBADF
FileHandle_Impl * pImpl = new FileHandle_Impl (fd);
- if (pImpl == nullptr)
- return nullptr; // ENOMEM
// assume writeable
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
@@ -809,11 +807,6 @@ openMemoryAsFile( void *address, size_t size, oslFileHandle *pHandle, const char
{
oslFileError eRet;
FileHandle_Impl * pImpl = new FileHandle_Impl (-1, FileHandle_Impl::KIND_MEM, path);
- if (!pImpl)
- {
- eRet = oslTranslateFileError (OSL_FET_ERROR, ENOMEM);
- return eRet;
- }
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(size);
*pHandle = (oslFileHandle)(pImpl);
@@ -1015,12 +1008,6 @@ openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags,
/* allocate memory for impl structure */
FileHandle_Impl * pImpl = new FileHandle_Impl (fd, FileHandle_Impl::KIND_FD, cpFilePath);
- if (!pImpl)
- {
- eRet = oslTranslateFileError (OSL_FET_ERROR, ENOMEM);
- (void) close(fd);
- return eRet;
- }
if (flags & O_RDWR)
pImpl->m_state |= FileHandle_Impl::STATE_WRITEABLE;
pImpl->m_size = sal::static_int_cast< sal_uInt64 >(aFileStat.st_size);
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 2fb488a48b57..3e6b36a2c8ca 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -148,13 +148,10 @@ static void osl_thread_init_Impl()
Thread_Impl* osl_thread_construct_Impl()
{
Thread_Impl* pImpl = new Thread_Impl;
- if (pImpl)
- {
- memset (pImpl, 0, sizeof(Thread_Impl));
+ memset (pImpl, 0, sizeof(Thread_Impl));
- pthread_mutex_init (&(pImpl->m_Lock), PTHREAD_MUTEXATTR_DEFAULT);
- pthread_cond_init (&(pImpl->m_Cond), PTHREAD_CONDATTR_DEFAULT);
- }
+ pthread_mutex_init (&(pImpl->m_Lock), PTHREAD_MUTEXATTR_DEFAULT);
+ pthread_cond_init (&(pImpl->m_Cond), PTHREAD_CONDATTR_DEFAULT);
return pImpl;
}
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index d7ef5623cd4e..97f6d8fe6d33 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -677,12 +677,6 @@ SAL_CALL osl_createFileHandleFromOSHandle (
return nullptr; // EINVAL
FileHandle_Impl * pImpl = new FileHandle_Impl(hFile);
- if (pImpl == nullptr)
- {
- // cleanup and fail
- (void) ::CloseHandle(hFile);
- return nullptr; // ENOMEM
- }
/* check for regular file */
if (FILE_TYPE_DISK == GetFileType(hFile))