[Spice-devel] [PATCH spice-server 1/2] replay: Remove some goto statement
Snir Sheriber
ssheribe at redhat.com
Sun Aug 11 09:03:04 UTC 2019
Acked-by: Snir Sheriber <ssheribe at redhat.com>
On 7/23/19 11:22 AM, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/tests/replay.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/server/tests/replay.c b/server/tests/replay.c
> index e3ef7bf15..992f26d63 100644
> --- a/server/tests/replay.c
> +++ b/server/tests/replay.c
> @@ -116,7 +116,7 @@ static gboolean fill_queue_idle(gpointer user_data)
> if (!cmd) {
> g_async_queue_push(display_queue, GINT_TO_POINTER(-1));
> g_async_queue_push(cursor_queue, GINT_TO_POINTER(-1));
> - goto end;
> + break;
> }
>
> ++ncommands;
> @@ -133,7 +133,6 @@ static gboolean fill_queue_idle(gpointer user_data)
> }
> }
>
> -end:
> if (!keep) {
> pthread_mutex_lock(&mutex);
> if (fill_source) {
> @@ -153,17 +152,12 @@ static void fill_queue(void)
> {
> pthread_mutex_lock(&mutex);
>
> - if (!started)
> - goto end;
> -
> - if (fill_source)
> - goto end;
> -
> - fill_source = g_idle_source_new();
> - g_source_set_callback(fill_source, fill_queue_idle, NULL, NULL);
> - g_source_attach(fill_source, basic_event_loop_get_context());
> + if (started && fill_source == NULL) {
> + fill_source = g_idle_source_new();
> + g_source_set_callback(fill_source, fill_queue_idle, NULL, NULL);
> + g_source_attach(fill_source, basic_event_loop_get_context());
> + }
>
> -end:
> pthread_mutex_unlock(&mutex);
> }
>
More information about the Spice-devel
mailing list