@@ -24,16 +24,15 @@ # include #endif #import "OFPollKernelEventObserver.h" #import "OFData.h" +#import "OFSocket+Private.h" #import "OFObserveFailedException.h" #import "OFOutOfRangeException.h" -#import "socket_helpers.h" - #ifdef OF_WII # define pollfd pollsd # define fd socket #endif @@ -48,11 +47,11 @@ _FDs = [[OFMutableData alloc] initWithItemSize: sizeof(struct pollfd)]; [_FDs addItem: &p]; _maxFD = _cancelFD[0]; - _FDToObject = of_alloc((size_t)_maxFD + 1, sizeof(id)); + _FDToObject = OFAllocMemory((size_t)_maxFD + 1, sizeof(id)); } @catch (id e) { [self release]; @throw e; } @@ -60,11 +59,11 @@ } - (void)dealloc { [_FDs release]; - free(_FDToObject); + OFFreeMemory(_FDToObject); [super dealloc]; } static void @@ -93,11 +92,11 @@ if (!found) { struct pollfd p = { fd, events, 0 }; if (fd > self->_maxFD) { self->_maxFD = fd; - self->_FDToObject = of_realloc(self->_FDToObject, + self->_FDToObject = OFResizeMemory(self->_FDToObject, (size_t)self->_maxFD + 1, sizeof(id)); } self->_FDToObject[fd] = object; [self->_FDs addItem: &p]; @@ -160,11 +159,11 @@ removeObject(self, object, object.fileDescriptorForWriting, POLLOUT); [super removeObjectForWriting: object]; } -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval { void *pool; struct pollfd *FDs; int events; size_t nFDs; @@ -197,14 +196,14 @@ if (FDs[i].fd == _cancelFD[0]) { char buffer; #ifdef OF_HAVE_PIPE - OF_ENSURE(read(_cancelFD[0], &buffer, 1) == 1); + OFEnsure(read(_cancelFD[0], &buffer, 1) == 1); #else - OF_ENSURE(recvfrom(_cancelFD[0], &buffer, 1, - 0, NULL, NULL) == 1); + OFEnsure(recvfrom(_cancelFD[0], &buffer, 1, 0, + NULL, NULL) == 1); #endif FDs[i].revents = 0; continue; }