Skip to content

Commit bd17a52

Browse files
committed
Add autoreleasepool to matches functions.
1 parent 90046c6 commit bd17a52

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Framework/SwiftOSC/Addresses/OSCAddressPattern.swift

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,24 @@ public struct OSCAddressPattern {
180180

181181
// Returns True if the address matches the address pattern.
182182
public func matches(_ address: OSCAddress)->Bool{
183-
if address.string.range(of: self.regex, options: .regularExpression) == nil {
184-
return false
185-
} else {
186-
return true
183+
var maches = true
184+
autoreleasepool {
185+
if address.string.range(of: self.regex, options: .regularExpression) == nil {
186+
maches = false
187+
}
187188
}
189+
return maches
188190
}
189191

190192
// Returns True if the address is along the path of the address pattern
191193
public func matches(path: OSCAddress)->Bool{
192-
if path.string.range(of: self.regexPath, options: .regularExpression) == nil {
193-
return false
194-
} else {
195-
return true
194+
var maches = true
195+
autoreleasepool {
196+
if path.string.range(of: self.regexPath, options: .regularExpression) == nil {
197+
maches = false
198+
}
196199
}
200+
return maches
197201
}
198202
}
199203

0 commit comments

Comments
 (0)