ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_select.c
(Generate patch)

Comparing libev/ev_select.c (file contents):
Revision 1.23 by root, Wed Nov 28 11:15:55 2007 UTC vs.
Revision 1.24 by root, Sun Dec 9 02:12:44 2007 UTC

88#else 88#else
89 89
90 int word = fd / NFDBITS; 90 int word = fd / NFDBITS;
91 int mask = 1UL << (fd % NFDBITS); 91 int mask = 1UL << (fd % NFDBITS);
92 92
93 if (vec_max < word + 1) 93 if (expect_false (vec_max < word + 1))
94 { 94 {
95 int new_max = word + 1; 95 int new_max = word + 1;
96 96
97 vec_ri = ev_realloc (vec_ri, new_max * NFDBYTES); 97 vec_ri = ev_realloc (vec_ri, new_max * NFDBYTES);
98 vec_ro = ev_realloc (vec_ro, new_max * NFDBYTES); /* could free/malloc */ 98 vec_ro = ev_realloc (vec_ro, new_max * NFDBYTES); /* could free/malloc */
132 tv.tv_sec = (long)timeout; 132 tv.tv_sec = (long)timeout;
133 tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6); 133 tv.tv_usec = (long)((timeout - (ev_tstamp)tv.tv_sec) * 1e6);
134 134
135 res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv); 135 res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv);
136 136
137 if (res < 0) 137 if (expect_false (res < 0))
138 { 138 {
139 #if EV_SELECT_IS_WINSOCKET 139 #if EV_SELECT_IS_WINSOCKET
140 errno = WSAGetLastError (); 140 errno = WSAGetLastError ();
141 #endif 141 #endif
142 142
166 #endif 166 #endif
167 167
168 if (FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ; 168 if (FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ;
169 if (FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE; 169 if (FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE;
170 170
171 if (events) 171 if (expect_true (events))
172 fd_event (EV_A_ fd, events); 172 fd_event (EV_A_ fd, events);
173 } 173 }
174 } 174 }
175 175
176#else 176#else
189 int events = 0; 189 int events = 0;
190 190
191 events |= word_r & mask ? EV_READ : 0; 191 events |= word_r & mask ? EV_READ : 0;
192 events |= word_w & mask ? EV_WRITE : 0; 192 events |= word_w & mask ? EV_WRITE : 0;
193 193
194 if (events) 194 if (expect_true (events))
195 fd_event (EV_A_ word * NFDBITS + bit, events); 195 fd_event (EV_A_ word * NFDBITS + bit, events);
196 } 196 }
197 } 197 }
198 } 198 }
199 199

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines