MXS-2196: Make DCB a C++ struct

Allocating DCB with new allows the use of C++ objects in the DCB
struct. Also the explicit poll field can be replaced by inheriting from
MXB_POLL_DATA.
This commit is contained in:
Markus Mäkelä
2018-11-30 15:37:40 +02:00
parent e365b97c6e
commit 694d4a4003
9 changed files with 153 additions and 206 deletions

View File

@ -174,9 +174,9 @@ class ResultSetDCB : public DCB
{
public:
ResultSetDCB()
: DCB(DCB_ROLE_CLIENT_HANDLER, nullptr, nullptr)
{
DCB* pDcb = this;
memset(pDcb, 0, sizeof(*pDcb));
pDcb->func.write = &ResultSetDCB::write;
}

View File

@ -18,8 +18,6 @@ namespace
void initialize_dcb(DCB* pDcb)
{
memset(pDcb, 0, sizeof(DCB));
pDcb->fd = DCBFD_CLOSED;
pDcb->state = DCB_STATE_ALLOC;
pDcb->ssl_state = SSL_HANDSHAKE_UNKNOWN;
@ -36,7 +34,8 @@ Dcb::Dcb(MXS_SESSION* pSession,
const char* zUser,
const char* zHost,
Handler* pHandler)
: m_user(zUser)
: DCB(DCB_ROLE_CLIENT_HANDLER, nullptr, nullptr)
, m_user(zUser)
, m_host(zHost)
, m_pHandler(pHandler)
{