From 9b2f06cbd27de4dd823d14f64b5609a693b6fbff Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 5 Feb 2007 21:55:24 +0100 Subject: [PATCH] audiod.c: [trivial] move close_stat_pipe() closer to its callers --- audiod.c | 75 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/audiod.c b/audiod.c index 0105fa36..2dba01c6 100644 --- a/audiod.c +++ b/audiod.c @@ -243,43 +243,6 @@ static int get_empty_slot(void) return -E_NO_MORE_SLOTS; } -static void close_stat_pipe(void) -{ - int i; - - if (!stat_task->pcd) - return; - client_close(stat_task->pcd); - stat_task->pcd = NULL; - for (i = 0; i < NUM_STAT_ITEMS; i++) { - free(stat_task->stat_item_values[i]); - stat_task->stat_item_values[i] = NULL; - } - dump_empty_status(); - stat_task->length_seconds = 0; - stat_task->offset_seconds = 0; - audiod_status_dump(); - stat_task->playing = 0; - stat_task->stat_item_values[SI_STATUS_BAR] = make_message( - "%s:no connection to para_server\n", - status_item_list[SI_STATUS_BAR]); - stat_client_write(stat_task->stat_item_values[SI_STATUS_BAR], - SI_STATUS_BAR); - if (stat_task->clock_diff_count) { - stat_task->clock_diff_barrier.tv_sec = now->tv_sec + 1; - stat_task->clock_diff_barrier.tv_usec = now->tv_usec; - } -} - -void __noreturn clean_exit(int status, const char *msg) -{ - PARA_EMERG_LOG("%s\n", msg); - if (socket_name) - unlink(socket_name); - close_stat_pipe(); - exit(status); -} - /** * get the number of filters * @@ -969,6 +932,44 @@ static void init_command_task(struct command_task *ct) sprintf(ct->task.status, "command task"); } +static void close_stat_pipe(void) +{ + int i; + + if (!stat_task->pcd) + return; + client_close(stat_task->pcd); + stat_task->pcd = NULL; + for (i = 0; i < NUM_STAT_ITEMS; i++) { + free(stat_task->stat_item_values[i]); + stat_task->stat_item_values[i] = NULL; + } + dump_empty_status(); + stat_task->length_seconds = 0; + stat_task->offset_seconds = 0; + audiod_status_dump(); + stat_task->playing = 0; + stat_task->stat_item_values[SI_STATUS_BAR] = make_message( + "%s:no connection to para_server\n", + status_item_list[SI_STATUS_BAR]); + stat_client_write(stat_task->stat_item_values[SI_STATUS_BAR], + SI_STATUS_BAR); + if (stat_task->clock_diff_count) { + stat_task->clock_diff_barrier.tv_sec = now->tv_sec + 1; + stat_task->clock_diff_barrier.tv_usec = now->tv_usec; + } +} + +void __noreturn clean_exit(int status, const char *msg) +{ + PARA_EMERG_LOG("%s\n", msg); + if (socket_name) + unlink(socket_name); + close_stat_pipe(); + exit(status); +} + + static void client_task_event_handler(__a_unused struct task *t) { struct private_client_data *pcd = t->private_data; -- 2.39.2