[Spice-devel,spice-server,7/8] red-record-qxl: replace continue with empty block

Submitted by Uri Lublin on Oct. 16, 2016, 11:44 a.m.

Details

Message ID 1476618295-26317-8-git-send-email-uril@redhat.com
State Superseded
Headers show
Series "More coverity fixes" ( rev: 2 1 ) in Spice

Not browsing as part of any series.

Commit Message

Uri Lublin Oct. 16, 2016, 11:44 a.m.
Spice coding style suggests to use curly braces
for while blocks.

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

Patch hide | download patch | download mbox

diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index 8af2c9c..adc487b 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -846,8 +846,8 @@  static void child_output_setup(gpointer user_data)
 {
     int fd = GPOINTER_TO_INT(user_data);
 
-    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR)
-        continue;
+    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
+    }
     close(fd);
 
     // make sure file is not closed calling exec()

Comments

> 
> Spice coding style suggests to use curly braces
> for while blocks.
> 
> Signed-off-by: Uri Lublin <uril@redhat.com>
> ---
>  server/red-record-qxl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
> index 8af2c9c..adc487b 100644
> --- a/server/red-record-qxl.c
> +++ b/server/red-record-qxl.c
> @@ -846,8 +846,8 @@ static void child_output_setup(gpointer user_data)
>  {
>      int fd = GPOINTER_TO_INT(user_data);
>  
> -    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR)
> -        continue;
> +    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
> +    }
>      close(fd);
>  
>      // make sure file is not closed calling exec()

There is another occurrence in the same file.
It's weird to see a close bracket just before a statement, perhaps a combination
of the two like

    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
        continue;
    }

is more "unexpected" ?

Frediano
On 10/17/2016 12:52 PM, Frediano Ziglio wrote:
>>
>> Spice coding style suggests to use curly braces
>> for while blocks.
>>
>> Signed-off-by: Uri Lublin <uril@redhat.com>
>> ---
>>  server/red-record-qxl.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
>> index 8af2c9c..adc487b 100644
>> --- a/server/red-record-qxl.c
>> +++ b/server/red-record-qxl.c
>> @@ -846,8 +846,8 @@ static void child_output_setup(gpointer user_data)
>>  {
>>      int fd = GPOINTER_TO_INT(user_data);
>>
>> -    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR)
>> -        continue;
>> +    while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
>> +    }
>>      close(fd);
>>
>>      // make sure file is not closed calling exec()
>
> There is another occurrence in the same file.

Yes, I'll modify both.

> It's weird to see a close bracket just before a statement, perhaps a combination
> of the two like
>
>     while (dup2(fd, STDOUT_FILENO) < 0 && errno == EINTR) {
>         continue;
>     }
>
> is more "unexpected" ?

OK, I do not find it weird but I can leave the "continue;" in the block.

Thanks,
     Uri