Ticket #31: cygwin-poll.diff
File cygwin-poll.diff, 1.0 KB (added by warner, at 2007-07-25T01:16:38Z) |
---|
-
Modules/selectmodule.c
old new 452 452 poll_poll(pollObject *self, PyObject *args) 453 453 { 454 454 PyObject *result_list = NULL, *tout = NULL; 455 int timeout = 0, poll_result, i, j ;455 int timeout = 0, poll_result, i, j, num_descriptors; 456 456 PyObject *value = NULL, *num = NULL; 457 457 458 458 if (!PyArg_UnpackTuple(args, "poll", 0, 1, &tout)) { … … 491 491 PyErr_SetFromErrno(SelectError); 492 492 return NULL; 493 493 } 494 494 495 /* count the number of fired descriptors */ 496 num_descriptors = 0; 497 for (i = 0; i < self->ufd_len; i++) { 498 if (self->ufds[i].revents) 499 num_descriptors++; 500 } 501 495 502 /* build the result list */ 496 503 497 result_list = PyList_New( poll_result);504 result_list = PyList_New(num_descriptors); 498 505 if (!result_list) 499 506 return NULL; 500 507 else { 501 for (i = 0, j = 0; j < poll_result; j++) {508 for (i = 0, j = 0; j < num_descriptors; j++) { 502 509 /* skip to the next fired descriptor */ 503 510 while (!self->ufds[i].revents) { 504 511 i++;