From 43fe81dd9f2d1c1e73b7293700e508e0d8c03263 Mon Sep 17 00:00:00 2001 From: Ryan Nystrom Date: Tue, 13 Feb 2018 10:07:45 -0800 Subject: [PATCH] Tell compiler not to retain in helper functions Summary: Tiny, measurable perf gain by removing any retains on these params. Reviewed By: manicakes Differential Revision: D6968685 fbshipit-source-id: f0ef1ecac6367661d125ea85dc1c9989bf2e9659 --- Source/Common/IGListDiff.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Common/IGListDiff.mm b/Source/Common/IGListDiff.mm index 98837c856..30b782188 100644 --- a/Source/Common/IGListDiff.mm +++ b/Source/Common/IGListDiff.mm @@ -47,7 +47,7 @@ } }; -static id IGListTableKey(id object) { +static id IGListTableKey(__unsafe_unretained id object) { id key = [object diffIdentifier]; NSCAssert(key != nil, @"Cannot use a nil key for the diffIdentifier of object %@", object); return key; @@ -65,7 +65,7 @@ size_t operator()(const id o) const { } }; -static void addIndexToMap(BOOL useIndexPaths, NSInteger section, NSInteger index, id object, NSMapTable *map) { +static void addIndexToMap(BOOL useIndexPaths, NSInteger section, NSInteger index, __unsafe_unretained id object, __unsafe_unretained NSMapTable *map) { id value; if (useIndexPaths) { value = [NSIndexPath indexPathForItem:index inSection:section]; @@ -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];