Skip to content

Commit

Permalink
Tell compiler not to retain in helper functions
Browse files Browse the repository at this point in the history
Summary: Tiny, measurable perf gain by removing any retains on these params.

Reviewed By: manicakes

Differential Revision: D6968685

fbshipit-source-id: f0ef1ecac6367661d125ea85dc1c9989bf2e9659
  • Loading branch information
Ryan Nystrom authored and facebook-github-bot committed Feb 13, 2018
1 parent 383660a commit 43fe81d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/Common/IGListDiff.mm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
};

static id<NSObject> IGListTableKey(id<IGListDiffable> object) {
static id<NSObject> IGListTableKey(__unsafe_unretained id<IGListDiffable> object) {
id<NSObject> key = [object diffIdentifier];
NSCAssert(key != nil, @"Cannot use a nil key for the diffIdentifier of object %@", object);
return key;
Expand All @@ -65,7 +65,7 @@ size_t operator()(const id o) const {
}
};

static void addIndexToMap(BOOL useIndexPaths, NSInteger section, NSInteger index, id<IGListDiffable> object, NSMapTable *map) {
static void addIndexToMap(BOOL useIndexPaths, NSInteger section, NSInteger index, __unsafe_unretained id<IGListDiffable> object, __unsafe_unretained NSMapTable *map) {
id value;
if (useIndexPaths) {
value = [NSIndexPath indexPathForItem:index inSection:section];
Expand All @@ -75,7 +75,7 @@ static void addIndexToMap(BOOL useIndexPaths, NSInteger section, NSInteger index
[map setObject:value forKey:[object diffIdentifier]];
}

static void addIndexToCollection(BOOL useIndexPaths, id collection, NSInteger section, NSInteger index) {
static void addIndexToCollection(BOOL useIndexPaths, __unsafe_unretained id collection, NSInteger section, NSInteger index) {
if (useIndexPaths) {
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:section];
[collection addObject:path];
Expand Down

0 comments on commit 43fe81d

Please sign in to comment.