Am 12.09.2017 11:27, schrieb Eric Engestrom:
> On Friday, 2017-09-08 20:03:03 +0200, walter harms wrote:
>> I found IceProtocolShutdown() hard to read only to find that was
>> it does it aktually very simple. So i rearranged the code to make
>> it more readable.
>>
>> Signed-off-by: Walter Harms <[email protected]>
>> ---
>>  src/shutdown.c | 47 ++++++++++++++++++++---------------------------
>>  1 file changed, 20 insertions(+), 27 deletions(-)
>>
>> diff --git a/src/shutdown.c b/src/shutdown.c
>> index 90e9ded..98376a7 100644
>> --- a/src/shutdown.c
>> +++ b/src/shutdown.c
>> @@ -40,45 +40,38 @@ IceProtocolShutdown (
>>      int     majorOpcode
>>  )
>>  {
>> +    int i;
>> +
>>      if (iceConn->proto_ref_count == 0 || iceConn->process_msg_info == NULL 
>> ||
>>          majorOpcode < 1 || majorOpcode > _IceLastMajorOpcode)
>>      {
>>      return (0);
>>      }
>> -    else
>> -    {
>> -    /*
>> -     * Make sure this majorOpcode is really being used.
>> -     */
>> -
>> -    int i;
>> +
>> +
>> +    /*
>> +     * Make sure this majorOpcode is really being used.
>> +     */
>>
>> -    for (i = iceConn->his_min_opcode; i <= iceConn->his_max_opcode; i++)
>> -    {
>> -        if (iceConn->process_msg_info[
>> -            i - iceConn->his_min_opcode].in_use &&
>> -                iceConn->process_msg_info[
>> -            i - iceConn->his_min_opcode].my_opcode == majorOpcode)
>> -            break;
>> -    }
>> +    for (i = iceConn->his_min_opcode; i <= iceConn->his_max_opcode; i++)
>> +      {
>> +    int n=i - iceConn->his_min_opcode;
> 
> spaces around `=`, and can you be more consistent with the indentation?
> (mostly avoid mixing tabs and spaces).


i can fix that, no problem.

tx for reviewing it
re,
 wh

> 
> With that fixed:
> Reviewed-by: Eric Engestrom <[email protected]>
> 
>> +    if (iceConn->process_msg_info[n].in_use &&
>> +        iceConn->process_msg_info[n].my_opcode == majorOpcode)
>> +      {
>>
>> -    if (i > iceConn->his_max_opcode)
>> -    {
>> -        return (0);
>> -    }
>> -    else
>> -    {
>>          /*
>>           * OK, we can shut down the protocol.
>>           */
>>
>> -        iceConn->process_msg_info[
>> -            i - iceConn->his_min_opcode].in_use = False;
>> -        iceConn->proto_ref_count--;
>> +          iceConn->process_msg_info[n].in_use = False;
>> +          iceConn->proto_ref_count--;
>> +          return (1);
>> +      }
>> +                            
>> +      }
>>
>> -        return (1);
>> -    }
>> -    }
>> +    return (0);
>>  }
>>
>>
>> -- 
>> 2.1.4
>>
> _______________________________________________
> [email protected]: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to