stream-manager: Revise pa_stream_manager_unref() to use new function to free hook... 83/214283/2
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 19 Sep 2019 23:04:56 +0000 (08:04 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 20 Sep 2019 03:06:22 +0000 (03:06 +0000)
It'll reduce cyclomatic complexity of SAM.

[Version] 11.1.82
[Issue Type] Refactoring

Change-Id: Iadc01db1502b3e7d35431a7a68ad2733098c0e5d
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/stream-manager.c

index d1fbf78..af55cd8 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          11.1.81
+Version:          11.1.82
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 156a690..cb9e9ec 100644 (file)
@@ -3624,28 +3624,13 @@ pa_stream_manager* pa_stream_manager_ref(pa_stream_manager *m) {
     return m;
 }
 
-void pa_stream_manager_unref(pa_stream_manager *m) {
-    void *state;
-    pa_idxset *streams;
-
+static void free_hook_slots(pa_stream_manager *m) {
     pa_assert(m);
-    pa_assert(PA_REFCNT_VALUE(m) > 0);
-
-    pa_log_info("pa_stream_manager_unref to %d", PA_REFCNT_VALUE(m) - 1);
-    if (PA_REFCNT_DEC(m) > 0)
-        return;
-
-    if (m->comm.comm) {
-        if (m->comm.comm_hook_device_connection_changed_slot)
-            pa_hook_slot_free(m->comm.comm_hook_device_connection_changed_slot);
-        if (m->comm.comm_hook_event_fully_handled_slot)
-            pa_hook_slot_free(m->comm.comm_hook_event_fully_handled_slot);
-        pa_communicator_unref(m->comm.comm);
-    }
-
-    if (m->subscription)
-        pa_subscription_free(m->subscription);
 
+    if (m->comm.comm_hook_device_connection_changed_slot)
+        pa_hook_slot_free(m->comm.comm_hook_device_connection_changed_slot);
+    if (m->comm.comm_hook_event_fully_handled_slot)
+        pa_hook_slot_free(m->comm.comm_hook_event_fully_handled_slot);
     if (m->sink_input_new_slot)
         pa_hook_slot_free(m->sink_input_new_slot);
     if (m->sink_input_put_slot)
@@ -3672,6 +3657,26 @@ void pa_stream_manager_unref(pa_stream_manager *m) {
         pa_hook_slot_free(m->source_output_move_start_slot);
     if (m->source_output_move_finish_slot)
         pa_hook_slot_free(m->source_output_move_finish_slot);
+}
+
+void pa_stream_manager_unref(pa_stream_manager *m) {
+    void *state;
+    pa_idxset *streams;
+
+    pa_assert(m);
+    pa_assert(PA_REFCNT_VALUE(m) > 0);
+
+    pa_log_info("pa_stream_manager_unref to %d", PA_REFCNT_VALUE(m) - 1);
+    if (PA_REFCNT_DEC(m) > 0)
+        return;
+
+    free_hook_slots(m);
+
+    if (m->comm.comm)
+        pa_communicator_unref(m->comm.comm);
+
+    if (m->subscription)
+        pa_subscription_free(m->subscription);
 
     if (m->muted_streams) {
         PA_HASHMAP_FOREACH(streams, m->muted_streams, state)