mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9912 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cf4d1390fc
commit
3dd58bdf6b
3 changed files with 72 additions and 68 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2001-05-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSConnection.m: Use respondsToSelector rather than respondsTo
|
||||||
|
* Source/NSRunLoop.m: ditto ... and tidy up categories to avoid
|
||||||
|
compiler warnings.
|
||||||
|
|
||||||
2001-05-08 Richard Frith-Macdonald <rfm@gnu.org>
|
2001-05-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Tools/gdomap.c: Fixes to last modifications - provided by
|
* Tools/gdomap.c: Fixes to last modifications - provided by
|
||||||
|
|
|
@ -837,7 +837,7 @@ static BOOL multi_threaded = NO;
|
||||||
|
|
||||||
/* Preferred MacOS-X version, which just allows the returning of BOOL */
|
/* Preferred MacOS-X version, which just allows the returning of BOOL */
|
||||||
del = [parent delegate];
|
del = [parent delegate];
|
||||||
if ([del respondsTo: @selector(connection:shouldMakeNewConnection:)])
|
if ([del respondsToSelector: @selector(connection:shouldMakeNewConnection:)])
|
||||||
{
|
{
|
||||||
if ([del connection: parent shouldMakeNewConnection: self] == NO)
|
if ([del connection: parent shouldMakeNewConnection: self] == NO)
|
||||||
{
|
{
|
||||||
|
@ -847,7 +847,7 @@ static BOOL multi_threaded = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Deprecated OpenStep version, which just allows the returning of BOOL */
|
/* Deprecated OpenStep version, which just allows the returning of BOOL */
|
||||||
if ([del respondsTo: @selector(makeNewConnection:sender:)])
|
if ([del respondsToSelector: @selector(makeNewConnection:sender:)])
|
||||||
{
|
{
|
||||||
if (![del makeNewConnection: self sender: parent])
|
if (![del makeNewConnection: self sender: parent])
|
||||||
{
|
{
|
||||||
|
@ -859,7 +859,7 @@ static BOOL multi_threaded = NO;
|
||||||
/* Here is the GNUstep version, which allows the delegate to specify
|
/* Here is the GNUstep version, which allows the delegate to specify
|
||||||
a substitute. Note: The delegate is responsible for freeing
|
a substitute. Note: The delegate is responsible for freeing
|
||||||
newConn if it returns something different. */
|
newConn if it returns something different. */
|
||||||
if ([del respondsTo: @selector(connection:didConnect:)])
|
if ([del respondsToSelector: @selector(connection:didConnect:)])
|
||||||
self = [del connection: parent didConnect: self];
|
self = [del connection: parent didConnect: self];
|
||||||
|
|
||||||
/* Register ourselves for invalidation notification when the
|
/* Register ourselves for invalidation notification when the
|
||||||
|
|
|
@ -391,7 +391,6 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
|
||||||
- (GSRunLoopWatcher*) _getWatcher: (void*)data
|
- (GSRunLoopWatcher*) _getWatcher: (void*)data
|
||||||
type: (RunLoopEventType)type
|
type: (RunLoopEventType)type
|
||||||
forMode: (NSString*)mode;
|
forMode: (NSString*)mode;
|
||||||
- (NSMutableArray*) _performers;
|
|
||||||
- (void) _removeWatcher: (void*)data
|
- (void) _removeWatcher: (void*)data
|
||||||
type: (RunLoopEventType)type
|
type: (RunLoopEventType)type
|
||||||
forMode: (NSString*)mode;
|
forMode: (NSString*)mode;
|
||||||
|
@ -501,6 +500,68 @@ static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (GSRunLoopWatcher*) _getWatcher: (void*)data
|
||||||
|
type: (RunLoopEventType)type
|
||||||
|
forMode: (NSString*)mode
|
||||||
|
{
|
||||||
|
GSIArray watchers;
|
||||||
|
|
||||||
|
if (mode == nil)
|
||||||
|
{
|
||||||
|
mode = _current_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
watchers = NSMapGet(_mode_2_watchers, mode);
|
||||||
|
if (watchers)
|
||||||
|
{
|
||||||
|
unsigned i = GSIArrayCount(watchers);
|
||||||
|
|
||||||
|
while (i-- > 0)
|
||||||
|
{
|
||||||
|
GSRunLoopWatcher *info;
|
||||||
|
|
||||||
|
info = GSIArrayItemAtIndex(watchers, i).obj;
|
||||||
|
if (info->type == type && info->data == data)
|
||||||
|
{
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) _removeWatcher: (void*)data
|
||||||
|
type: (RunLoopEventType)type
|
||||||
|
forMode: (NSString*)mode
|
||||||
|
{
|
||||||
|
GSIArray watchers;
|
||||||
|
|
||||||
|
if (mode == nil)
|
||||||
|
{
|
||||||
|
mode = _current_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
watchers = NSMapGet(_mode_2_watchers, mode);
|
||||||
|
if (watchers)
|
||||||
|
{
|
||||||
|
unsigned i = GSIArrayCount(watchers);
|
||||||
|
|
||||||
|
while (i-- > 0)
|
||||||
|
{
|
||||||
|
GSRunLoopWatcher *info;
|
||||||
|
|
||||||
|
info = GSIArrayItemAtIndex(watchers, i).obj;
|
||||||
|
if (info->type == type && info->data == data)
|
||||||
|
{
|
||||||
|
info->_invalidated = YES;
|
||||||
|
GSIArrayRemoveItemAtIndex(watchers, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation NSRunLoop(GNUstepExtensions)
|
@implementation NSRunLoop(GNUstepExtensions)
|
||||||
|
|
||||||
|
@ -949,69 +1010,6 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
|
||||||
return when;
|
return when;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (GSRunLoopWatcher*) _getWatcher: (void*)data
|
|
||||||
type: (RunLoopEventType)type
|
|
||||||
forMode: (NSString*)mode
|
|
||||||
{
|
|
||||||
GSIArray watchers;
|
|
||||||
|
|
||||||
if (mode == nil)
|
|
||||||
{
|
|
||||||
mode = _current_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
watchers = NSMapGet(_mode_2_watchers, mode);
|
|
||||||
if (watchers)
|
|
||||||
{
|
|
||||||
unsigned i = GSIArrayCount(watchers);
|
|
||||||
|
|
||||||
while (i-- > 0)
|
|
||||||
{
|
|
||||||
GSRunLoopWatcher *info;
|
|
||||||
|
|
||||||
info = GSIArrayItemAtIndex(watchers, i).obj;
|
|
||||||
if (info->type == type && info->data == data)
|
|
||||||
{
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) _removeWatcher: (void*)data
|
|
||||||
type: (RunLoopEventType)type
|
|
||||||
forMode: (NSString*)mode
|
|
||||||
{
|
|
||||||
GSIArray watchers;
|
|
||||||
|
|
||||||
if (mode == nil)
|
|
||||||
{
|
|
||||||
mode = _current_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
watchers = NSMapGet(_mode_2_watchers, mode);
|
|
||||||
if (watchers)
|
|
||||||
{
|
|
||||||
unsigned i = GSIArrayCount(watchers);
|
|
||||||
|
|
||||||
while (i-- > 0)
|
|
||||||
{
|
|
||||||
GSRunLoopWatcher *info;
|
|
||||||
|
|
||||||
info = GSIArrayItemAtIndex(watchers, i).obj;
|
|
||||||
if (info->type == type && info->data == data)
|
|
||||||
{
|
|
||||||
info->_invalidated = YES;
|
|
||||||
GSIArrayRemoveItemAtIndex(watchers, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Listen to input sources.
|
/* Listen to input sources.
|
||||||
If LIMIT_DATE is nil, then don't wait; i.e. call select() with 0 timeout */
|
If LIMIT_DATE is nil, then don't wait; i.e. call select() with 0 timeout */
|
||||||
|
|
||||||
|
@ -1158,7 +1156,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
|
||||||
int port_fd_count = 128; // xxx #define this constant
|
int port_fd_count = 128; // xxx #define this constant
|
||||||
int port_fd_array[port_fd_count];
|
int port_fd_array[port_fd_count];
|
||||||
|
|
||||||
if ([port respondsTo: @selector(getFds:count:)])
|
if ([port respondsToSelector: @selector(getFds:count:)])
|
||||||
[port getFds: port_fd_array count: &port_fd_count];
|
[port getFds: port_fd_array count: &port_fd_count];
|
||||||
if (debug_run_loop)
|
if (debug_run_loop)
|
||||||
printf("\tNSRunLoop listening to %d sockets\n",
|
printf("\tNSRunLoop listening to %d sockets\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue