audiod: Kill another unused variable
[paraslash.git] / audiod.c
index eab44b4..107fb35 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -448,11 +448,21 @@ static void kill_stream_writer(int slot_num)
        s->fci->error = 1;
 }
 
+static void set_restart_barrier(int format, struct timeval *now)
+{
+       struct timeval tmp;
+
+       if (now)
+               tmp = *now;
+       else
+               gettimeofday(&tmp, NULL);
+       tv_add(&tmp, &restart_delay, &afi[format].restart_barrier);
+}
+
 static void close_receiver(int slot_num)
 {
        struct slot_info *s = &slot[slot_num];
        struct audio_format_info *a;
-       struct timeval now;
 
        if (s->format < 0 || !s->receiver_node)
                return;
@@ -462,8 +472,7 @@ static void close_receiver(int slot_num)
        a->receiver->close(s->receiver_node);
        free(s->receiver_node);
        s->receiver_node = NULL;
-       gettimeofday(&now, NULL);
-       tv_add(&now, &restart_delay, &a->restart_barrier); /* FIXME: Use set_restart_barrier() */
+       set_restart_barrier(s->format, NULL);
 }
 
 static void kill_all_decoders(void)
@@ -477,17 +486,6 @@ static void kill_all_decoders(void)
                }
 }
 
-static void set_restart_barrier(int format, struct timeval *now)
-{
-       struct timeval tmp;
-
-       if (now)
-               tmp = *now;
-       else
-               gettimeofday(&tmp, NULL);
-       tv_add(&tmp, &restart_delay, &afi[format].restart_barrier);
-}
-
 static void check_sigchld(void)
 {
        pid_t pid;
@@ -569,7 +567,7 @@ static void close_stat_pipe(void)
        stat_pipe = -1;
        kill_all_decoders();
        for (i = 0; i < RINGBUFFER_SIZE; i++)
-               ringbuffer_add(stat_item_ringbuf, para_strdup(NULL));
+               free(ringbuffer_add(stat_item_ringbuf, para_strdup(NULL)));
        dump_empty_status();
        length_seconds = 0;
        offset_seconds = 0;
@@ -577,9 +575,8 @@ static void close_stat_pipe(void)
        playing = 0;
        msg = make_message("%s:no connection to para_server\n",
                status_item_list[SI_STATUS_BAR]);
-       ringbuffer_add(stat_item_ringbuf, msg);
+       free(ringbuffer_add(stat_item_ringbuf, msg));
        stat_client_write(msg);
-       free(msg);
 }
 
 static void __noreturn clean_exit(int status, const char *msg)
@@ -806,7 +803,7 @@ static void check_stat_line(char *line)
 
        if (!line)
                return;
-       ringbuffer_add(stat_item_ringbuf, line);
+       free(ringbuffer_add(stat_item_ringbuf, para_strdup(line)));
        stat_client_write(line);
        itemnum = stat_line_valid(line);
        if (itemnum < 0)
@@ -1545,7 +1542,7 @@ repeat:
                } else {
                        status_buf[ret + sbo] = '\0';
                        sbo = for_each_line(status_buf, ret + sbo,
-                               &check_stat_line, 0);
+                               &check_stat_line);
                }
        }
        slot_io(&wfds);