Revision: 28798
http://sourceforge.net/p/bibdesk/svn/28798
Author: hofman
Date: 2024-02-22 14:59:40 +0000 (Thu, 22 Feb 2024)
Log Message:
-----------
shouldn't need to cache return value fromObjectAtIndex:
Modified Paths:
--------------
trunk/bibdesk/BDSKFieldCollection.m
Modified: trunk/bibdesk/BDSKFieldCollection.m
===================================================================
--- trunk/bibdesk/BDSKFieldCollection.m 2024-02-22 00:25:50 UTC (rev 28797)
+++ trunk/bibdesk/BDSKFieldCollection.m 2024-02-22 14:59:40 UTC (rev 28798)
@@ -117,7 +117,7 @@
self = [super init];
if (self) {
fieldCollection = collection;
- fieldNames = [[NSMutableArray alloc] initWithCapacity:[array count]];
+ fieldNames = nil;
fields = [[NSMutableArray alloc] initWithCapacity:[array count]];
for (NSString *name in array)
if ([fieldCollection isUsedField:name] == NO)
@@ -131,14 +131,12 @@
}
- (id)objectAtIndex:(NSUInteger)idx{
- id field = [fieldCollection fieldForName:[fieldNames objectAtIndex:idx]];
- [fields addObject:field];
- return field;
+ return [fieldCollection fieldForName:[fieldNames objectAtIndex:idx]];
}
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id __unsafe_unretained *)stackbuf count:(NSUInteger)len {
if (state->state == 0) {
- [fields removeAllObjects];
+ fieldNames = [[NSMutableArray alloc] initWithCapacity:[fieldNames
count]];
for (NSString *name in fieldNames)
[fields addObject:[fieldCollection fieldForName:name]];
}
@@ -150,7 +148,6 @@
while (i--)
if ([fieldCollection isEmptyField:[fieldNames objectAtIndex:i]])
[fieldNames removeObjectAtIndex:i];
- [fields removeAllObjects];
return self;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit