From 2893de65acc4eced9ccbb5430ddfb6a73d0a968b Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 9 Oct 2016 17:39:01 +0100 Subject: [PATCH] Ensure that the code is consistently formatted. --- src/libespeak-ng/event.c | 17 +++++++++-------- src/libespeak-ng/fifo.c | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/libespeak-ng/event.c b/src/libespeak-ng/event.c index a8086ab9..954d4730 100644 --- a/src/libespeak-ng/event.c +++ b/src/libespeak-ng/event.c @@ -241,9 +241,10 @@ espeak_ng_STATUS event_clear_all() return status; if (a_event_is_running) { - while(my_stop_is_acknowledged == 0) - while((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR) - continue; // Restart when interrupted by handler + while (my_stop_is_acknowledged == 0) { + while ((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR) + continue; // Restart when interrupted by handler + } } return ENS_OK; @@ -259,9 +260,10 @@ static void *polling_thread(void *p) int a_status = pthread_mutex_lock(&my_mutex); my_event_is_running = 0; - while(my_start_is_required == 0) - while((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR) - continue; // Restart when interrupted by handler + while (my_start_is_required == 0) { + while ((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR) + continue; // Restart when interrupted by handler + } my_event_is_running = 1; a_stop_is_required = 0; @@ -271,7 +273,6 @@ static void *polling_thread(void *p) // In this loop, my_event_is_running = 1 while (head && (a_stop_is_required == 0)) { - espeak_EVENT *event = (espeak_EVENT *)(head->data); assert(event); @@ -286,7 +287,7 @@ static void *polling_thread(void *p) a_status = pthread_mutex_lock(&my_mutex); event_delete((espeak_EVENT *)pop()); a_stop_is_required = my_stop_is_required; - if(a_stop_is_required > 0) + if (a_stop_is_required > 0) my_stop_is_required = 0; a_status = pthread_mutex_unlock(&my_mutex); diff --git a/src/libespeak-ng/fifo.c b/src/libespeak-ng/fifo.c index 8f58a33e..6b1fa926 100644 --- a/src/libespeak-ng/fifo.c +++ b/src/libespeak-ng/fifo.c @@ -91,9 +91,10 @@ void fifo_init() // leave once the thread is actually started assert(-1 != pthread_mutex_lock(&my_mutex)); - while (my_stop_is_acknowledged == 0) -while((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR) - ; + while (my_stop_is_acknowledged == 0) { + while ((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR) + ; + } my_stop_is_acknowledged = 0; pthread_mutex_unlock(&my_mutex); } @@ -173,9 +174,10 @@ espeak_ng_STATUS fifo_stop() } if (a_command_is_running) { - while (my_stop_is_acknowledged == 0) - while((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR) + while (my_stop_is_acknowledged == 0) { + while ((pthread_cond_wait(&my_cond_stop_is_acknowledged, &my_mutex) == -1) && errno == EINTR) continue; // Restart when interrupted by handler + } } my_stop_is_required = 0; @@ -295,9 +297,10 @@ static void *say_thread(void *p) assert(!a_status); if (!a_start_is_required) { - while (my_start_is_required == 0) - while((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR) - continue; // Restart when interrupted by handler + while (my_start_is_required == 0) { + while ((pthread_cond_wait(&my_cond_start_is_required, &my_mutex) == -1) && errno == EINTR) + continue; // Restart when interrupted by handler + } }