Re: [PATCH v2] glib/gpoll: Remove if conditional

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH v2] glib/gpoll: Remove if conditional

Alistair Francis
On Fri, Jul 7, 2017 at 11:02 AM, Alistair Francis
<[hidden email]> wrote:
> The original ready < nhandles - 1 can be re-written as ready + 1 < nhandles
> which is the same confition that we are checking on the first
> itteration of the for loop. This means we can remove the if statement
> and let the for loop check the code.
>
> This also has the side effect of removing an invalid check as
> WAIT_OBJECT_0 was not subtracted from ready in the if statement.
>
> Signed-off-by: Alistair Francis <[hidden email]>

Ping!

> ---
> v2:
>  - Rebase on master
>  - Remove the first patch in the series as it was incorrect
>
>  glib/gpoll.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/glib/gpoll.c b/glib/gpoll.c
> index 265cb9210..b6c83d8ed 100644
> --- a/glib/gpoll.c
> +++ b/glib/gpoll.c
> @@ -235,9 +235,8 @@ poll_rest (gboolean  poll_msgs,
>         {
>           /* Remove the handle that fired */
>           int i;
> -         if (ready < nhandles - 1)
> -           for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++)
> -             handles[i-1] = handles[i];
> +         for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++)
> +           handles[i-1] = handles[i];
>           nhandles--;
>           recursed_result = poll_rest (FALSE, handles, nhandles, fds, nfds, 0);
>           return (recursed_result == -1) ? -1 : 1 + recursed_result;
> --
> 2.11.0
>
_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH v2] glib/gpoll: Remove if conditional

Bastien Nocera
Patches are best attached to bugzilla. You can use "git-bz" to file the bug and attach your path directly there.

Don't hesitate to reply if you have trouble filing the bug or attaching the patch.

Cheers

> On 26 Jul 2017, at 22:16, Alistair Francis <[hidden email]> wrote:
>
> On Fri, Jul 7, 2017 at 11:02 AM, Alistair Francis
> <[hidden email]> wrote:
>> The original ready < nhandles - 1 can be re-written as ready + 1 < nhandles
>> which is the same confition that we are checking on the first
>> itteration of the for loop. This means we can remove the if statement
>> and let the for loop check the code.
>>
>> This also has the side effect of removing an invalid check as
>> WAIT_OBJECT_0 was not subtracted from ready in the if statement.
>>
>> Signed-off-by: Alistair Francis <[hidden email]>
>
> Ping!
>
>> ---
>> v2:
>> - Rebase on master
>> - Remove the first patch in the series as it was incorrect
>>
>> glib/gpoll.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/glib/gpoll.c b/glib/gpoll.c
>> index 265cb9210..b6c83d8ed 100644
>> --- a/glib/gpoll.c
>> +++ b/glib/gpoll.c
>> @@ -235,9 +235,8 @@ poll_rest (gboolean  poll_msgs,
>>        {
>>          /* Remove the handle that fired */
>>          int i;
>> -         if (ready < nhandles - 1)
>> -           for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++)
>> -             handles[i-1] = handles[i];
>> +         for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++)
>> +           handles[i-1] = handles[i];
>>          nhandles--;
>>          recursed_result = poll_rest (FALSE, handles, nhandles, fds, nfds, 0);
>>          return (recursed_result == -1) ? -1 : 1 + recursed_result;
>> --
>> 2.11.0
>>
> _______________________________________________
> gtk-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-devel-list

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH v2] glib/gpoll: Remove if conditional

Alistair Francis
On Wed, Jul 26, 2017 at 3:35 PM, Bastien Nocera <[hidden email]> wrote:
> Patches are best attached to bugzilla. You can use "git-bz" to file the bug and attach your path directly there.
>
> Don't hesitate to reply if you have trouble filing the bug or attaching the patch.

Thanks, after pinging this I did some searching and found that
Bugzilla. I have opened a case there. Thanks for pointing that out
though.

Thanks,
Alistair

>
> Cheers
>
>> On 26 Jul 2017, at 22:16, Alistair Francis <[hidden email]> wrote:
>>
>> On Fri, Jul 7, 2017 at 11:02 AM, Alistair Francis
>> <[hidden email]> wrote:
>>> The original ready < nhandles - 1 can be re-written as ready + 1 < nhandles
>>> which is the same confition that we are checking on the first
>>> itteration of the for loop. This means we can remove the if statement
>>> and let the for loop check the code.
>>>
>>> This also has the side effect of removing an invalid check as
>>> WAIT_OBJECT_0 was not subtracted from ready in the if statement.
>>>
>>> Signed-off-by: Alistair Francis <[hidden email]>
>>
>> Ping!
>>
>>> ---
>>> v2:
>>> - Rebase on master
>>> - Remove the first patch in the series as it was incorrect
>>>
>>> glib/gpoll.c | 5 ++---
>>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/glib/gpoll.c b/glib/gpoll.c
>>> index 265cb9210..b6c83d8ed 100644
>>> --- a/glib/gpoll.c
>>> +++ b/glib/gpoll.c
>>> @@ -235,9 +235,8 @@ poll_rest (gboolean  poll_msgs,
>>>        {
>>>          /* Remove the handle that fired */
>>>          int i;
>>> -         if (ready < nhandles - 1)
>>> -           for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++)
>>> -             handles[i-1] = handles[i];
>>> +         for (i = ready - WAIT_OBJECT_0 + 1; i < nhandles; i++)
>>> +           handles[i-1] = handles[i];
>>>          nhandles--;
>>>          recursed_result = poll_rest (FALSE, handles, nhandles, fds, nfds, 0);
>>>          return (recursed_result == -1) ? -1 : 1 + recursed_result;
>>> --
>>> 2.11.0
>>>
>> _______________________________________________
>> gtk-devel-list mailing list
>> [hidden email]
>> https://mail.gnome.org/mailman/listinfo/gtk-devel-list
>
_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Loading...