]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/hook-list.c
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / hook-list.c
index 0aac475910fe653b3c0e7fe1ea01dc6eadd63d44..ed07cea4829513d834b5b4d25c6265f90cc655b1 100644 (file)
@@ -5,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
-  published by the Free Software Foundation; either version 2 of the
+  published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif
 
+#include <pulse/xmalloc.h>
+
 #include <pulsecore/macro.h>
 
 #include "hook-list.h"
@@ -44,7 +46,7 @@ static void slot_free(pa_hook *hook, pa_hook_slot *slot) {
     pa_xfree(slot);
 }
 
-void pa_hook_free(pa_hook *hook) {
+void pa_hook_done(pa_hook *hook) {
     pa_assert(hook);
     pa_assert(hook->n_firing == 0);
 
@@ -61,7 +63,7 @@ pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_priority_t prio, pa_hook_cb
 
     slot = pa_xnew(pa_hook_slot, 1);
     slot->hook = hook;
-    slot->dead = FALSE;
+    slot->dead = false;
     slot->callback = cb;
     slot->data = data;
     slot->priority = prio;
@@ -83,7 +85,7 @@ void pa_hook_slot_free(pa_hook_slot *slot) {
     pa_assert(!slot->dead);
 
     if (slot->hook->n_firing > 0) {
-        slot->dead = TRUE;
+        slot->dead = true;
         slot->hook->n_dead++;
     } else
         slot_free(slot->hook, slot);
@@ -97,7 +99,7 @@ pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) {
 
     hook->n_firing ++;
 
-    for (slot = hook->slots; slot; slot = slot->next) {
+    PA_LLIST_FOREACH(slot, hook->slots) {
         if (slot->dead)
             continue;
 
@@ -121,3 +123,9 @@ pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) {
 
     return result;
 }
+
+bool pa_hook_is_firing(pa_hook *hook) {
+    pa_assert(hook);
+
+    return hook->n_firing > 0;
+}