From 1199f0d2c14fbc0c4df4aa6070642e004bb4a576 Mon Sep 17 00:00:00 2001 From: fedor Date: Tue, 12 Mar 2002 15:25:37 +0000 Subject: [PATCH] Apple constant string updates git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13097 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Headers/gnustep/base/NSString.h | 14 ++++++++++++-- Source/GSString.m | 15 ++++----------- Source/NSProcessInfo.m | 8 ++++++++ Testing/release.m | 3 --- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1aedffaf..0ae78e1ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-03-12 Adam Fedor + + * Headers/gnustep/base/NSString.h: Add extra ivars needed by Darwin + to NXConstantString. + * Source/GSString.m: ([NXConstantString +initialize]): Remove constant + string class reference setup for Darwin. + * Source/NSProcessInfo.m (main): Put it here. + Tue Mar 12 11:13:51 2002 Nicola Pero * Source/Additions/GSXML.m ([-isEqualTo:]): Renamed everywhere to diff --git a/Headers/gnustep/base/NSString.h b/Headers/gnustep/base/NSString.h index ff6020258..189483c82 100644 --- a/Headers/gnustep/base/NSString.h +++ b/Headers/gnustep/base/NSString.h @@ -330,6 +330,15 @@ enum { */ @interface NXConstantString : NSString { +#if defined(__APPLE__) && __GCC__ >= 3 + /* Up to gcc 2.95.2 the compiler slipped these two in automatically. + With the advent of ObjC++ this is no longer possible (?). + There is no Apple modified gcc between 2.95.2 and 3.1. + This info ia as of 2002-03-04 and regarding the experimental + Apple gcc 3.1. Markus Hitter, mah@jump-ing.de */ + char *cString; + unsigned int len; +#endif union { unichar *u; unsigned char *c; @@ -338,8 +347,9 @@ enum { } @end -#if NeXT_RUNTIME -/* For internal use with NeXT runtime. */ +#ifdef NeXT_RUNTIME +/* For internal use with NeXT runtime; + needed, until Apple Radar 2870817 is fixed. */ extern struct objc_class _NSConstantStringClassReference; #endif diff --git a/Source/GSString.m b/Source/GSString.m index 822b51d6b..ec4988955 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -52,8 +52,11 @@ #include -/* Used by the Darwin/NeXT ObjC Runtime */ +#ifdef NeXT_RUNTIME +/* Used by the Darwin/NeXT ObjC Runtime + until Apple Radar 2870817 is fixed. */ struct objc_class _NSConstantStringClassReference; +#endif /* * GSPlaceholderString - placeholder class for objects awaiting intialisation. @@ -3324,17 +3327,7 @@ transmute(ivars self, NSString *aString) { if (self == [NXConstantString class]) { -#if NeXT_RUNTIME - struct objc_class *ref = self; -#endif behavior_class_add_class(self, [GSCString class]); - -#if NeXT_RUNTIME - /* Set up a structure to represent the constant string class. All constant strings point to - this structure. - */ - _NSConstantStringClassReference = *ref; -#endif } } diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index bd0faf47a..5899cd037 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -500,6 +500,14 @@ _gnu_noobjc_free_vars(void) #undef main int main(int argc, char *argv[], char *env[]) { +#ifdef NeXT_RUNTIME + /* This memcpy has to be done before the first message is sent to any + constant string object. See Apple Radar 2870817 */ + memcpy(&_NSConstantStringClassReference, + objc_getClass("NSConstantString"), + sizeof(_NSConstantStringClassReference)); +#endif + #if defined(__MINGW__) WSADATA lpWSAData; diff --git a/Testing/release.m b/Testing/release.m index d58212d43..52b3f3ffe 100644 --- a/Testing/release.m +++ b/Testing/release.m @@ -1,9 +1,6 @@ #include #include #include -#ifndef _WIN32 -#include "malloc.h" -#endif @interface ReleaseTester : NSObject {