@@ -130,10 +130,18 @@ forKey: key]; [pool releaseObjects]; } [pool release]; + + /* + * Class swizzle the environment to be immutable, as we don't + * need to change it anymore and expose it only as + * OFDictionary*. But not swizzling it would create a real copy + * each time -[copy] is called. + */ + environment->isa = [OFDictionary class]; } @catch (id e) { [self release]; @throw e; } @@ -156,10 +164,17 @@ arguments = [[OFMutableArray alloc] init]; for (i = 1; i < *argc; i++) [arguments addObject: [OFString stringWithCString: (*argv)[i]]]; + /* + * Class swizzle the arguments to be immutable, as we don't need to + * change them anymore and expose them only as OFArray*. But not + * swizzling it would create a real copy each time -[copy] is called. + */ + arguments->isa = [OFArray class]; + [pool release]; } - (void)getArgumentCount: (int**)argc_ andArgumentValues: (char****)argv_ @@ -168,21 +183,21 @@ *argv_ = argv; } - (OFString*)programName { - return [[programName retain] autorelease]; + return [[programName copy] autorelease]; } - (OFArray*)arguments { - return [[arguments retain] autorelease]; + return [[arguments copy] autorelease]; } - (OFDictionary*)environment { - return [[environment retain] autorelease]; + return [[environment copy] autorelease]; } - (id )delegate { return [[(id)delegate retain] autorelease];