Commit 63ccf819 authored by Sergey Lyubka's avatar Sergey Lyubka

Style changes in poll()

parent 6bc6022a
...@@ -187,7 +187,7 @@ typedef struct DIR { ...@@ -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) { ...@@ -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) { ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment