Cleanup to get rid of a few global variables

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23768 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-10-05 19:27:15 +00:00
parent 6ce9e7743d
commit 87d678828a
7 changed files with 41 additions and 24 deletions

View file

@ -1,6 +1,11 @@
2006-10-05 Richard Frith-Macdonald <rfm@gnu.org> 2006-10-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: Add a couple more charset mappings. * Source/Additions/GSMime.m: Add a couple more charset mappings.
* Source/NSRunLoop.m: Move some variables to GSRunLoopCtxt.m
* Source/GSHTTPURLHandle.m: Make a global static
* Source/NSPort.m: Make two globals static
* Source/unix/GSRunLoopCtxt.m: Make variable static.
* Source/win32/GSRunLoopCtxt.m: Make variable static.
2006-10-04 Richard Frith-Macdonald <rfm@gnu.org> 2006-10-04 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -81,7 +81,7 @@ typedef void (*NSMT_retain_func_t)(NSMapTable *, const void *);
typedef void (*NSMT_release_func_t)(NSMapTable *, void *); typedef void (*NSMT_release_func_t)(NSMapTable *, void *);
typedef NSString *(*NSMT_describe_func_t)(NSMapTable *, const void *); typedef NSString *(*NSMT_describe_func_t)(NSMapTable *, const void *);
const NSMapTableKeyCallBacks writeKeyCallBacks = static const NSMapTableKeyCallBacks writeKeyCallBacks =
{ {
(NSMT_hash_func_t) _non_retained_id_hash, (NSMT_hash_func_t) _non_retained_id_hash,
(NSMT_is_equal_func_t) _non_retained_id_is_equal, (NSMT_is_equal_func_t) _non_retained_id_is_equal,

View file

@ -669,7 +669,7 @@ typedef struct {
@defs(NSBundle) @defs(NSBundle)
} *bptr; } *bptr;
void static void
_bundle_load_callback(Class theClass, struct objc_category *theCategory) _bundle_load_callback(Class theClass, struct objc_category *theCategory)
{ {
NSCAssert(_loadingBundle, NSInternalInconsistencyException); NSCAssert(_loadingBundle, NSInternalInconsistencyException);

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSPort class reference</title> <title>NSPort class reference</title>
$Date$ $Revision$ $Date$ $Revision$
@ -53,8 +54,8 @@
*/ */
NSString * const NSPortTimeoutException = @"NSPortTimeoutException"; NSString * const NSPortTimeoutException = @"NSPortTimeoutException";
Class NSPort_abstract_class; static Class NSPort_abstract_class;
Class NSPort_concrete_class; static Class NSPort_concrete_class;
+ (id) allocWithZone: (NSZone*)aZone + (id) allocWithZone: (NSZone*)aZone
{ {

View file

@ -632,11 +632,6 @@ static NSComparisonResult tSort(GSIArrayItem i0, GSIArrayItem i1)
@end @end
extern SEL wRelSel;
extern SEL wRetSel;
extern IMP wRelImp;
extern IMP wRetImp;
/** /**
* <p><code>NSRunLoop</code> instances handle various utility tasks that must * <p><code>NSRunLoop</code> instances handle various utility tasks that must
* be performed repetitively in an application, such as processing input * be performed repetitively in an application, such as processing input
@ -662,12 +657,6 @@ extern IMP wRetImp;
{ {
[self currentRunLoop]; [self currentRunLoop];
theFuture = RETAIN([NSDate distantFuture]); theFuture = RETAIN([NSDate distantFuture]);
#if GS_WITH_GC == 0
wRelSel = @selector(release);
wRetSel = @selector(retain);
wRelImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRelSel];
wRetImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRetSel];
#endif
} }
} }

View file

@ -33,10 +33,10 @@
extern BOOL GSCheckTasks(); extern BOOL GSCheckTasks();
#if GS_WITH_GC == 0 #if GS_WITH_GC == 0
SEL wRelSel; static SEL wRelSel;
SEL wRetSel; static SEL wRetSel;
IMP wRelImp; static IMP wRelImp;
IMP wRetImp; static IMP wRetImp;
static void static void
wRelease(NSMapTable* t, void* w) wRelease(NSMapTable* t, void* w)
@ -61,6 +61,17 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
#endif #endif
@implementation GSRunLoopCtxt @implementation GSRunLoopCtxt
+ (void) initialize
{
#if GS_WITH_GC == 0
wRelSel = @selector(release);
wRetSel = @selector(retain);
wRelImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRelSel];
wRetImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRetSel];
#endif
}
- (void) dealloc - (void) dealloc
{ {
RELEASE(mode); RELEASE(mode);

View file

@ -20,10 +20,10 @@
extern BOOL GSCheckTasks(); extern BOOL GSCheckTasks();
#if GS_WITH_GC == 0 #if GS_WITH_GC == 0
SEL wRelSel; static SEL wRelSel;
SEL wRetSel; static SEL wRetSel;
IMP wRelImp; static IMP wRelImp;
IMP wRetImp; static IMP wRetImp;
static void static void
wRelease(NSMapTable* t, void* w) wRelease(NSMapTable* t, void* w)
@ -48,6 +48,17 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
#endif #endif
@implementation GSRunLoopCtxt @implementation GSRunLoopCtxt
+ (void) initialize
{
#if GS_WITH_GC == 0
wRelSel = @selector(release);
wRetSel = @selector(retain);
wRelImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRelSel];
wRetImp = [[GSRunLoopWatcher class] instanceMethodForSelector: wRetSel];
#endif
}
- (void) dealloc - (void) dealloc
{ {
RELEASE(mode); RELEASE(mode);