@@ -200,10 +200,16 @@ [ret addObject: [OFString stringWithCString: path_c + last length: i - last]]; [pool release]; + /* + * Class swizzle the array to be immutable. We declared the return type + * to be OFArray*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + ret->isa = [OFArray class]; return ret; } + (OFString*)lastComponentOfPath: (OFString*)path { @@ -386,10 +392,16 @@ } @finally { FindClose(handle); } #endif + /* + * Class swizzle the array to be immutable. We declared the return type + * to be OFArray*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + files->isa = [OFArray class]; return files; } + (void)changeToDirectory: (OFString*)path {