[Spice-devel,v2,4/6] red-record-qxl: add curly braces to empty while loop

Submitted by Uri Lublin on Dec. 6, 2016, 4:06 p.m.

Details

Message ID 20161206160631.30624-5-uril@redhat.com
State Accepted
Commit 4be1a6ec8c794f6847cb21f076f6f4dcbfb5862f
Headers show
Series "More coverity fixes" ( rev: 3 ) in Spice

Not browsing as part of any series.

Commit Message

Uri Lublin Dec. 6, 2016, 4:06 p.m.
Spice coding style suggests to use curly braces
for while blocks.

Some prefer the block to not be empty so continue
is untouched.

Signed-off-by: Uri Lublin <uril@redhat.com>
---
 server/red-record-qxl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index 14a68a7..184d6b9 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -847,8 +847,9 @@  static void child_output_setup(gpointer user_data)
 {
     int fd = GPOINTER_TO_INT(user_data);
 
-    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR)
+    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
         continue;
+    }
     close(fd);
 
     // make sure file is not closed calling exec()
@@ -890,8 +891,9 @@  RedRecord *red_record_new(const char *filename)
             fclose(f);
             spice_error("failed to setup filter for replay");
         }
-        while (dup2(fd_in, fileno(f)) < 0 && errno == EINTR)
+        while (dup2(fd_in, fileno(f)) < 0 && errno == EINTR) {
             continue;
+        }
         close(fd_in);
     }
 

Comments

> 
> Spice coding style suggests to use curly braces
> for while blocks.
> 
> Some prefer the block to not be empty so continue
> is untouched.
> 
> Signed-off-by: Uri Lublin <uril@redhat.com>
> ---
>  server/red-record-qxl.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
> index 14a68a7..184d6b9 100644
> --- a/server/red-record-qxl.c
> +++ b/server/red-record-qxl.c
> @@ -847,8 +847,9 @@ static void child_output_setup(gpointer user_data)
>  {
>      int fd = GPOINTER_TO_INT(user_data);
>  
> -    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR)
> +    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
>          continue;
> +    }
>      close(fd);
>  
>      // make sure file is not closed calling exec()
> @@ -890,8 +891,9 @@ RedRecord *red_record_new(const char *filename)
>              fclose(f);
>              spice_error("failed to setup filter for replay");
>          }
> -        while (dup2(fd_in, fileno(f)) < 0 && errno == EINTR)
> +        while (dup2(fd_in, fileno(f)) < 0 && errno == EINTR) {
>              continue;
> +        }
>          close(fd_in);
>      }
>  

Acked-by: Frediano Ziglio <fziglio@redhat.com>

Frediano