mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +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:
@@ -235,6 +235,20 @@
|
||||
s; \
|
||||
})
|
||||
|
||||
/**
|
||||
* Create a new ObjectPointerPersonality NSHashTable by mapping `collection` over `work`, ignoring nil.
|
||||
*/
|
||||
#define ASPointerTableByFlatMapping(collection, decl, work) ({ \
|
||||
NSHashTable *t = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; \
|
||||
for (decl in collection) {\
|
||||
id result = work; \
|
||||
if (result != nil) { \
|
||||
[t addObject:result]; \
|
||||
} \
|
||||
} \
|
||||
t; \
|
||||
})
|
||||
|
||||
/**
|
||||
* Create a new array by mapping `collection` over `work`, ignoring nil.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user