X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=augment%2Fmodule-dir-watch.c;h=56b4c67675731c8cf14233f5169e5cf1d343e21f;hb=0e9676f19dd8ce8e13cbb92fecd5d832f55062ab;hp=cc0c49037de6d21bfc44d3c6a6070ed9f7e9c268;hpb=9b098f33307f41a668dd9e4931c4748d3a855670;p=profile%2Fivi%2Fpulseaudio-module-murphy-ivi.git diff --git a/augment/module-dir-watch.c b/augment/module-dir-watch.c index cc0c490..56b4c67 100644 --- a/augment/module-dir-watch.c +++ b/augment/module-dir-watch.c @@ -55,7 +55,7 @@ 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 { @@ -172,7 +172,7 @@ static void dir_watch_inotify_cb( pa_log_debug("> inotify_cb"); - while (TRUE) { + while (true) { r = pa_read(fd, &eventbuf, sizeof(eventbuf), &type); @@ -285,7 +285,7 @@ static int add_directory(const char *directory, pa_client *c, struct userdata *u 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; @@ -302,14 +302,14 @@ static pa_hook_result_t client_unlink_cb( 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; } } @@ -362,6 +362,10 @@ fail: 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); @@ -376,8 +380,19 @@ void pa__done(pa_module *m) { 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);