prevented HeapMmgr::allocMem() and HeapMmgr::reallocMem() from thrown an exception

This commit is contained in:
hyung-hwan 2018-07-01 07:59:06 +00:00
parent 9ff9cb1d55
commit 1a102644ed
5 changed files with 17 additions and 21 deletions

View File

@ -109,7 +109,7 @@ public:
///
/// The dispose() function calls freeMem() for memory disposal.
///
void dispose (void* ptr)
void dispose (void* ptr) QSE_CPP_NOEXCEPT
{
this->freeMem (ptr);
}

View File

@ -41,7 +41,7 @@ QSE_BEGIN_NAMESPACE(QSE)
// The TcpServer class implements a simple block TCP server that start a thread
// for each connection accepted.
class TcpServer: public Uncopyable, public Mmged, public Types
class QSE_EXPORT TcpServer: public Uncopyable, public Mmged, public Types
{
public:
TcpServer (Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT;
@ -176,7 +176,7 @@ private:
// functor as a template parameter
template <typename F>
class TcpServerF: public TcpServer
class QSE_EXPORT TcpServerF: public TcpServer
{
public:
TcpServerF (Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT: TcpServer(mmgr) {}
@ -201,7 +201,7 @@ template <typename T>
class TcpServerL;
template <typename RT, typename... ARGS>
class TcpServerL<RT(ARGS...)>: public TcpServer
class QSE_EXPORT TcpServerL<RT(ARGS...)>: public TcpServer
{
public:
TcpServerL (Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT: TcpServer(mmgr), __lfunc(nullptr) {}

View File

@ -33,7 +33,7 @@
QSE_BEGIN_NAMESPACE(QSE)
class Thread: public Uncopyable, public Mmged
class QSE_EXPORT Thread: public Uncopyable, public Mmged
{
public:
// native thread handle type
@ -94,7 +94,7 @@ protected:
static Handle INVALID_HANDLE;
};
class ThreadR: public Thread
class QSE_EXPORT ThreadR: public Thread
{
public:
ThreadR (Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT: Thread(mmgr) {}
@ -109,7 +109,7 @@ protected:
};
template <typename F>
class ThreadF: public Thread
class QSE_EXPORT ThreadF: public Thread
{
public:
ThreadF (Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT: Thread(mmgr) {}
@ -163,7 +163,7 @@ template <typename T>
class ThreadL;
template <typename RT, typename... ARGS>
class ThreadL<RT(ARGS...)>: public Thread
class QSE_EXPORT ThreadL<RT(ARGS...)>: public Thread
{
public:
ThreadL (Mmgr* mmgr = QSE_NULL) QSE_CPP_NOEXCEPT: Thread(mmgr), __lfunc(nullptr) {}

View File

@ -62,9 +62,7 @@ void* HeapMmgr::allocMem (qse_size_t n) QSE_CPP_NOEXCEPT
xtn->heap = this;
}
void* xptr = qse_xma_alloc (this->xma, n);
if (!xptr) QSE_THROW (MemoryError);
return xptr;
return qse_xma_alloc(this->xma, n);
}
void* HeapMmgr::reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT
@ -78,9 +76,7 @@ void* HeapMmgr::reallocMem (void* ptr, qse_size_t n) QSE_CPP_NOEXCEPT
xtn->heap = this;
}
void* xptr = qse_xma_realloc (this->xma, ptr, n);
if (!xptr) QSE_THROW (MemoryError);
return xptr;
return qse_xma_realloc(this->xma, ptr, n);
}
void HeapMmgr::freeMem (void* ptr) QSE_CPP_NOEXCEPT

View File

@ -29,7 +29,7 @@ public:
qse_ssize_t n;
cliaddr->toStrBuf(addrbuf, QSE_COUNTOF(addrbuf));
//qse_printf (QSE_T("hello word..from %s\n"), addrbuf);
qse_printf (QSE_T("hello word..from %s\n"), addrbuf);
while (!server->isStopRequested())
{
@ -41,7 +41,7 @@ public:
clisock->send (bb, n);
}
//qse_printf (QSE_T("byte to %s\n"), addrbuf);
qse_printf (QSE_T("byte to %s\n"), addrbuf);
return 0;
}
};