Removed heap allocation when polling sockets.
This commit is contained in:
parent
47ca409ff9
commit
809a347333
|
@ -274,7 +274,8 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
|
|||
}
|
||||
|
||||
// allocate space for translated query
|
||||
struct pollfd* pfd = new struct pollfd[num];
|
||||
struct pollfd* pfd = reinterpret_cast<struct pollfd*>(
|
||||
alloca(num * sizeof(struct pollfd)));
|
||||
|
||||
// translate query
|
||||
for (int i = 0; i < num; ++i) {
|
||||
|
@ -298,7 +299,6 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
|
|||
ARCH->testCancelThread();
|
||||
continue;
|
||||
}
|
||||
delete[] pfd;
|
||||
throwError(errno);
|
||||
}
|
||||
} while (false);
|
||||
|
@ -320,9 +320,6 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
|
|||
}
|
||||
}
|
||||
|
||||
// done with translated query
|
||||
delete[] pfd;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue