Skip to content

Commit c026ab2

Browse files
committed
More efficient cache key generation.
1 parent 3f85e7a commit c026ab2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/OCMock/NSObject+OCMAdditions.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector
3232
_OCMReturnTypeCache = [[NSMutableDictionary alloc] init];
3333

3434
BOOL needsStructureReturn;
35-
NSString *cacheKey = [NSString stringWithFormat:@"%p-%p", (void *)self, aSelector];
35+
void *rawCacheKey[2] = { (void *)self, aSelector };
36+
NSData *cacheKey = [NSData dataWithBytes:rawCacheKey length:sizeof(rawCacheKey)];
3637
NSNumber *cachedValue = [_OCMReturnTypeCache objectForKey:cacheKey];
3738

3839
if(cachedValue == nil)

0 commit comments

Comments
 (0)