Tidy last NSArray change with minor performance tweak, apply bugfix for code

attempting to deal with minor problems in mime data being parsed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18336 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-01-08 08:07:29 +00:00
parent 45b685d011
commit 785c2ed63c
3 changed files with 30 additions and 18 deletions

View file

@ -1,3 +1,12 @@
2004-01-08 Alexander Malmberg <alexander@malmberg.org>
* Source/Additions/GSMiume.m: Fix bad use of NSString as C-string
2004-01-07 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSArray.m: minor cleanups to use gnucoding conventions for
whitespace and little performance tweak (cache NSNull instance).
2004-01-08 01:48 Alexander Malmberg <alexander@malmberg.org>
* Headers/Additions/GNUstepBase/GSCategories.h

View file

@ -1245,7 +1245,7 @@ wordData(NSString *word)
if (flags.wantEndOfLine == 1)
{
result = [self parse: [NSData dataWithBytes: @"\r\n" length: 2]];
result = [self parse: [NSData dataWithBytes: "\r\n" length: 2]];
}
else if (flags.inBody == 1)
{
@ -1257,7 +1257,7 @@ wordData(NSString *word)
* If still parsing headers, add CR-LF sequences to terminate
* the headers.
*/
result = [self parse: [NSData dataWithBytes: @"\r\n\r\n" length: 4]];
result = [self parse: [NSData dataWithBytes: "\r\n\r\n" length: 4]];
}
flags.wantEndOfLine = 0;
flags.inBody = 0;

View file

@ -1142,7 +1142,7 @@ compare(id elem1, id elem2, void* context)
*/
- (id) valueForKey: (NSString*)key
{
id result=nil;
id result = nil;
if ([key isEqualToString: @"count"] == YES)
{
@ -1150,31 +1150,33 @@ compare(id elem1, id elem2, void* context)
}
else
{
NSMutableArray *results = nil;
NSNull* null=nil;
int i, count = [self count];
volatile id object = nil;
NSMutableArray *results = nil;
static NSNull *null = nil;
unsigned i;
unsigned count = [self count];
volatile id object = nil;
results = [NSMutableArray array];
for(i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
id result;
id result;
object = [self objectAtIndex: i];
result = [object valueForKey: key];
if (!result)
if (result == nil)
{
if (!null)
null=[NSNull null];
if (null == nil)
{
null = RETAIN([NSNull null]);
}
result = null;
}
[results addObject: result];
}
result=results;
result = results;
}
return result;
}
@ -1778,14 +1780,15 @@ compare(id elem1, id elem2, void* context)
*/
- (void) setValue: (id)value forKey: (NSString*)key
{
int i, count = [self count];
volatile id object = nil;
unsigned i;
unsigned count = [self count];
volatile id object = nil;
for(i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
object = [self objectAtIndex: i];
[object setValue: value
forKey: key];
forKey: key];
}
}
@end