aeCommand objects no need for memset and missing init of some memebers.

Former-commit-id: aeed09c34620e465b57f1d83553d259c4f6d892f
This commit is contained in:
Muhammad Zahalqa 2020-06-13 19:13:38 +03:00 committed by John Sully
parent 49fecbe1d4
commit c4cd846388

View File

@ -234,7 +234,7 @@ int aeCreateRemoteFileEvent(aeEventLoop *eventLoop, int fd, int mask,
int ret = AE_OK; int ret = AE_OK;
aeCommand cmd = {}; aeCommand cmd;
cmd.op = AE_ASYNC_OP::CreateFileEvent; cmd.op = AE_ASYNC_OP::CreateFileEvent;
cmd.fd = fd; cmd.fd = fd;
cmd.mask = mask; cmd.mask = mask;
@ -294,7 +294,6 @@ int aePostFunction(aeEventLoop *eventLoop, std::function<void()> fn, bool fSynch
} }
aeCommand cmd = {}; aeCommand cmd = {};
memset(&cmd, 0, sizeof(aeCommand));
cmd.op = AE_ASYNC_OP::PostCppFunction; cmd.op = AE_ASYNC_OP::PostCppFunction;
cmd.pfn = new (MALLOC_LOCAL) std::function<void()>(fn); cmd.pfn = new (MALLOC_LOCAL) std::function<void()>(fn);
cmd.pctl = nullptr; cmd.pctl = nullptr;
@ -454,7 +453,7 @@ void aeDeleteFileEventAsync(aeEventLoop *eventLoop, int fd, int mask)
{ {
if (eventLoop == g_eventLoopThisThread) if (eventLoop == g_eventLoopThisThread)
return aeDeleteFileEvent(eventLoop, fd, mask); return aeDeleteFileEvent(eventLoop, fd, mask);
aeCommand cmd; aeCommand cmd = {};
cmd.op = AE_ASYNC_OP::DeleteFileEvent; cmd.op = AE_ASYNC_OP::DeleteFileEvent;
cmd.fd = fd; cmd.fd = fd;
cmd.mask = mask; cmd.mask = mask;