[HAVE_POLL] (-pollUntil:within:): Set fdEnd to pollfds_count instead of setting it separately (which was being done incorrectly).

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15920 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-02-10 13:02:46 +00:00
parent 1cf0fce6ae
commit a4a56f6bcf
2 changed files with 8 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2003-02-10 13:56 Alexander Malmberg <alexander@malmberg.org>
* Source/NSRunLoop.m [HAVE_POLL] (-pollUntil:within:): Set fdEnd
to pollfds_count instead of setting it separately (which was being
done incorrectly).
2003-02-07 19:21 Alexander Malmberg <alexander@malmberg.org> 2003-02-07 19:21 Alexander Malmberg <alexander@malmberg.org>
* Source/GSAttributedString (-setAttributes:range:): Fix memory * Source/GSAttributedString (-setAttributes:range:): Fix memory

View file

@ -563,7 +563,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
- (BOOL) pollUntil: (int)milliseconds within: (NSArray*)contexts - (BOOL) pollUntil: (int)milliseconds within: (NSArray*)contexts
{ {
int poll_return; int poll_return;
int fdEnd = 0; /* Number of descriptors being monitored. */ int fdEnd; /* Number of descriptors being monitored. */
int fdIndex; int fdIndex;
int fdFinish; int fdFinish;
unsigned int i; unsigned int i;
@ -614,21 +614,18 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
fd = (int)info->data; fd = (int)info->data;
setPollfd(fd, POLLPRI, self); setPollfd(fd, POLLPRI, self);
NSMapInsert(_efdMap, (void*)fd, info); NSMapInsert(_efdMap, (void*)fd, info);
fdEnd++;
break; break;
case ET_RDESC: case ET_RDESC:
fd = (int)info->data; fd = (int)info->data;
setPollfd(fd, POLLIN, self); setPollfd(fd, POLLIN, self);
NSMapInsert(_rfdMap, (void*)fd, info); NSMapInsert(_rfdMap, (void*)fd, info);
fdEnd++;
break; break;
case ET_WDESC: case ET_WDESC:
fd = (int)info->data; fd = (int)info->data;
setPollfd(fd, POLLOUT, self); setPollfd(fd, POLLOUT, self);
NSMapInsert(_wfdMap, (void*)fd, info); NSMapInsert(_wfdMap, (void*)fd, info);
fdEnd++;
break; break;
case ET_RPORT: case ET_RPORT:
@ -660,7 +657,6 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
setPollfd(fd, POLLIN, self); setPollfd(fd, POLLIN, self);
NSMapInsert(_rfdMap, NSMapInsert(_rfdMap,
(void*)port_fd_array[port_fd_count], info); (void*)port_fd_array[port_fd_count], info);
fdEnd++;
} }
} }
break; break;
@ -742,6 +738,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
* inputs where multiple inputs are in use. Note - fairStart can be * inputs where multiple inputs are in use. Note - fairStart can be
* modified while we are in the loop (by recursive calls). * modified while we are in the loop (by recursive calls).
*/ */
fdEnd = pollfds_count;
if (++fairStart >= fdEnd) if (++fairStart >= fdEnd)
{ {
fairStart = 0; fairStart = 0;