Removed heap allocation when polling sockets.

This commit is contained in:
crs 2003-09-02 22:06:07 +00:00
parent 47ca409ff9
commit 809a347333
1 changed files with 2 additions and 5 deletions

View File

@ -274,7 +274,8 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
} }
// allocate space for translated query // 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 // translate query
for (int i = 0; i < num; ++i) { for (int i = 0; i < num; ++i) {
@ -298,7 +299,6 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
ARCH->testCancelThread(); ARCH->testCancelThread();
continue; continue;
} }
delete[] pfd;
throwError(errno); throwError(errno);
} }
} while (false); } while (false);
@ -320,9 +320,6 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
} }
} }
// done with translated query
delete[] pfd;
return n; return n;
} }