mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Replace NSMutableSet with NSHashTable when Appropriate #trivial (#321)
* Use NSHashTable to avoid needless -hash and -isEqual: calls * Mark debug-only methods as such for clarity * Address feedback
This commit is contained in:
@@ -854,10 +854,6 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
|
||||
#pragma mark - Layout
|
||||
|
||||
#if DEBUG
|
||||
#define AS_DEDUPE_LAYOUT_SPEC_TREE 1
|
||||
#endif
|
||||
|
||||
// At most a layoutSpecBlock or one of the three layout methods is overridden
|
||||
#define __ASDisplayNodeCheckForLayoutMethodOverrides \
|
||||
ASDisplayNodeAssert(_layoutSpecBlock != NULL || \
|
||||
@@ -1002,7 +998,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
ASLayoutSpec *layoutSpec = (ASLayoutSpec *)layoutElement;
|
||||
|
||||
#if AS_DEDUPE_LAYOUT_SPEC_TREE
|
||||
NSSet *duplicateElements = [layoutSpec findDuplicatedElementsInSubtree];
|
||||
NSHashTable *duplicateElements = [layoutSpec findDuplicatedElementsInSubtree];
|
||||
if (duplicateElements.count > 0) {
|
||||
ASDisplayNodeFailAssert(@"Node %@ returned a layout spec that contains the same elements in multiple positions. Elements: %@", self, duplicateElements);
|
||||
// Use an empty layout spec to avoid crashes
|
||||
|
||||
Reference in New Issue
Block a user