mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-12 16:50:21 +00:00
Style changes in poll()
This commit is contained in:
1 parent
6bc6022aa9
commit
63ccf8199f
1 file changed
+3
-4
+3
-4
@@ -187,7 +187,7 @@ typedef struct DIR {
|
|||||||
struct dirent result;
|
struct dirent result;
|
||||||
} DIR;
|
} DIR;
|
||||||
|
|
||||||
#ifndef HAS_POLL
|
#ifndef HAVE_POLL
|
||||||
struct pollfd {
|
struct pollfd {
|
||||||
int fd;
|
int fd;
|
||||||
short events;
|
short events;
|
||||||
@@ -1222,8 +1222,7 @@ static struct dirent *readdir(DIR *dir) {
|
|||||||
static int poll(struct pollfd *pfd, int n, int milliseconds) {
|
static int poll(struct pollfd *pfd, int n, int milliseconds) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
fd_set set;
|
fd_set set;
|
||||||
int i, result;
|
int i, result, maxfd = 0;
|
||||||
int maxfd = 0;
|
|
||||||
|
|
||||||
tv.tv_sec = milliseconds / 1000;
|
tv.tv_sec = milliseconds / 1000;
|
||||||
tv.tv_usec = (milliseconds % 1000) * 1000;
|
tv.tv_usec = (milliseconds % 1000) * 1000;
|
||||||
@@ -1238,7 +1237,7 @@ static int poll(struct pollfd *pfd, int n, int milliseconds) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result = select(maxfd+1, &set, NULL, NULL, &tv)) > 0) {
|
if ((result = select(maxfd + 1, &set, NULL, NULL, &tv)) > 0) {
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (FD_ISSET(pfd[i].fd, &set)) {
|
if (FD_ISSET(pfd[i].fd, &set)) {
|
||||||
pfd[i].revents = POLLIN;
|
pfd[i].revents = POLLIN;
|
||||||
|
|||||||
Reference in new issue
Block a user