PA_MODULE_AUTHOR("Ismo Puustinen");
PA_MODULE_DESCRIPTION("Directory watch module");
PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_LOAD_ONCE(true);
PA_MODULE_USAGE("");
struct userdata {
pa_log_debug("> inotify_cb");
- while (TRUE) {
+ while (true) {
r = pa_read(fd, &eventbuf, sizeof(eventbuf), &type);
PA_LLIST_PREPEND(struct client_id, cd->ids, id);
- pa_hashmap_put(u->paths_to_clients, (const void *)0 + wd, (void *) cd);
+ pa_hashmap_put(u->paths_to_clients, (void *)0 + wd, (void *) cd);
}
#endif
return 0;
void *state;
struct client_data *cd;
struct client_id *id;
- pa_bool_t found = FALSE;
+ bool found = false;
PA_HASHMAP_FOREACH(cd, u->paths_to_clients, state) {
PA_LLIST_FOREACH(id, cd->ids) {
if (id->id == c->index) {
PA_LLIST_REMOVE(struct client_id, cd->ids, id);
pa_xfree(id);
- found = TRUE;
+ found = true;
break;
}
}
void pa__done(pa_module *m) {
struct userdata *u;
+#ifdef HAVE_INOTIFY
+ void *state;
+ struct client_data *cd;
+#endif
pa_assert(m);
pa_assert(m->userdata);
pa_close(u->inotify_fd);
- if (u->paths_to_clients)
- pa_hashmap_free(u->paths_to_clients, (pa_free_cb_t) client_data_free);
+ if (u->paths_to_clients) {
+
+ PA_HASHMAP_FOREACH(cd, u->paths_to_clients, state) {
+ pa_xfree(cd->directory);
+ while(cd->ids) {
+ struct client_id *id = cd->ids;
+ PA_LLIST_REMOVE(struct client_id, cd->ids, id);
+ pa_xfree(id);
+ }
+ }
+
+ pa_hashmap_free(u->paths_to_clients);
+ }
#endif
pa_xfree(u);