[vlc-devel] [PATCH 7/9] VLCKit: inlined code from a method that had only one caller
Florent Pillet
fpillet at gmail.com
Fri Jul 11 01:35:09 CEST 2014
---
Sources/VLCEventManager.m | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/Sources/VLCEventManager.m b/Sources/VLCEventManager.m
index 8b4ab27..18f9ed6 100644
--- a/Sources/VLCEventManager.m
+++ b/Sources/VLCEventManager.m
@@ -82,7 +82,6 @@ typedef enum
- (void)callDelegateOfObjectAndSendNotificationWithArgs:(message_t *)message;
- (void)callObjectMethodWithArgs:(message_t *)message;
-- (void)callDelegateOfObject:(id)aTarget withDelegateMethod:(SEL)aSelector withNotificationName:(NSString *)aNotificationName;
- (pthread_cond_t *)signalData;
- (pthread_mutex_t *)queueLock;
@@ -328,9 +327,16 @@ static void * EventDispatcherMainLoop(void * user_data)
- (void)callDelegateOfObjectAndSendNotificationWithArgs:(message_t *)message
{
// Check that we were not cancelled, ie, target was released
- if ([self markMessageHandledOnMainThreadIfExists:message])
- [self callDelegateOfObject:message.target withDelegateMethod:message.sel withNotificationName:message.name];
+ if ([self markMessageHandledOnMainThreadIfExists:message]) {
+ id target = message.target;
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:message.object object:target]];
+ id delegate = [target delegate];
+ if ([delegate respondsToSelector:message.sel]) {
+ void (*method)(id, SEL, id) = (void (*)(id, SEL, id)) [delegate methodForSelector:message.sel];
+ method(delegate, message.sel, [NSNotification notificationWithName:message.object object:target]);
+ }
+ }
}
- (void)callObjectMethodWithArgs:(message_t *)message
@@ -342,18 +348,6 @@ static void * EventDispatcherMainLoop(void * user_data)
}
}
-- (void)callDelegateOfObject:(id)aTarget withDelegateMethod:(SEL)aSelector withNotificationName:(NSString *)aNotificationName
-{
- [[NSNotificationCenter defaultCenter] postNotification: [NSNotification notificationWithName:aNotificationName object:aTarget]];
-
- id delegate = [aTarget delegate];
- if (!delegate || ![delegate respondsToSelector:aSelector])
- return;
-
- void (*method)(id, SEL, id) = (void (*)(id, SEL, id))[delegate methodForSelector: aSelector];
- method(delegate, aSelector, [NSNotification notificationWithName:aNotificationName object:aTarget]);
-}
-
- (pthread_cond_t *)signalData
{
return &_signalData;
--
1.8.5.2 (Apple Git-48)
More information about the vlc-devel
mailing list