[maccode] r286 committed - Cache the IMP inside countByEnumeratingWithState:objects:count (NSFast...

0 views
Skip to first unread message

codesite...@google.com

unread,
Aug 11, 2009, 8:18:29 PM8/11/09
to mac...@googlegroups.com
Revision: 286
Author: stephen.holt
Date: Tue Aug 11 17:17:26 2009
Log: Cache the IMP inside countByEnumeratingWithState:objects:count
(NSFastEnumeration).

http://code.google.com/p/maccode/source/detail?r=286

Modified:
/trunk/Utilities/AutoHyperlinks Framework/Source/AHHyperlinkScanner.m

=======================================
--- /trunk/Utilities/AutoHyperlinks Framework/Source/AHHyperlinkScanner.m
Tue Aug 11 16:41:46 2009
+++ /trunk/Utilities/AutoHyperlinks Framework/Source/AHHyperlinkScanner.m
Tue Aug 11 17:17:26 2009
@@ -373,9 +373,11 @@
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(id *)stackbuf count:(NSUInteger)len
{
AHMarkedHyperlink *currentLink;
+ SEL nextURISelector = @selector(nextURI);
+ IMP nextURIImp = [self methodForSelector:nextURISelector];

NSUInteger fastEnumCount = 0;
- while (fastEnumCount < len && nil != (currentLink = [self nextURI])) {
+ while (fastEnumCount < len && nil != (currentLink = (AHMarkedHyperlink
*)(*nextURIImp)(self, nextURISelector))) {
stackbuf[fastEnumCount] = currentLink;
++fastEnumCount;
}

Reply all
Reply to author
Forward
0 new messages