Skip to content

Commit b77cc87

Browse files
nivi-applebzbarsky-apple
authored andcommitted
Apply suggestions from code review
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 0f76b5f commit b77cc87

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/darwin/Framework/CHIP/MTRDevice.mm

+3-4
Original file line numberDiff line numberDiff line change
@@ -3089,15 +3089,14 @@ - (void)_pruneClustersIn:(MTRDeviceDataValueDictionary)previousServerListValue
30893089
forEndpoint:(NSNumber *)endpointID
30903090
{
30913091
// If the server list changed and clusters were removed, remove those clusters from our data structures.
3092-
// Also remove it from the data store.
3092+
// Also remove them from the data store.
30933093
NSMutableSet<NSNumber *> * toBeRemovedClusters = [NSMutableSet setWithArray:[self arrayOfNumbersFromAttributeValue:previousServerListValue]];
30943094
NSSet<NSNumber *> * clustersStillOnEndpoint = [NSSet setWithArray:[self arrayOfNumbersFromAttributeValue:newServerListValue]];
30953095
[toBeRemovedClusters minusSet:clustersStillOnEndpoint];
30963096

30973097
NSMutableSet<MTRClusterPath *> * clusterPathsToRemove = [[NSMutableSet alloc] init];
3098-
for (NSNumber * cluster in toBeRemovedClusters) {
3099-
for (MTRClusterPath * path in _persistedClusters) {
3100-
if ([path.endpoint isEqualToNumber:endpointID] && [path.cluster isEqualToNumber:cluster]) {
3098+
for (MTRClusterPath * path in _persistedClusters) {
3099+
if ([path.endpoint isEqualToNumber:endpointID] && [toBeRemovedClusters containsObject:path.cluster])
31013100
[clusterPathsToRemove addObject:path];
31023101
}
31033102
}

0 commit comments

Comments
 (0)