[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 for-2.9 03/10] io vnc sockets: Clean up SocketA
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [RFC v2 for-2.9 03/10] io vnc sockets: Clean up SocketAddressKind switches |
Date: |
Mon, 3 Apr 2017 14:50:12 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 03.04.2017 13:48, Daniel P. Berrange wrote:
> On Thu, Mar 30, 2017 at 03:15:00PM +0200, Markus Armbruster wrote:
>> We have quite a few switches over SocketAddressKind. Some have case
>> labels for all enumeration values, others rely on a default label.
>> Some abort when the value isn't a valid SocketAddressKind, others
>> report an error then.
>>
>> Unify as follows. Always provide case labels for all enumeration
>> values, to clarify intent. Abort when the value isn't a valid
>> SocketAddressKind, because the program state is messed up then.
>>
>> Improve a few error messages while there.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> Reviewed-by: Max Reitz <address@hidden>
>> ---
>> io/dns-resolver.c | 7 +++++--
>> ui/vnc.c | 18 ++++++++++++------
>> util/qemu-sockets.c | 4 +---
>> 3 files changed, 18 insertions(+), 11 deletions(-)
>>
>> diff --git a/io/dns-resolver.c b/io/dns-resolver.c
>> index 0ac6b23..a407075 100644
>> --- a/io/dns-resolver.c
>> +++ b/io/dns-resolver.c
>> @@ -164,9 +164,12 @@ int qio_dns_resolver_lookup_sync(QIODNSResolver
>> *resolver,
>> addrs,
>> errp);
>>
>> + case SOCKET_ADDRESS_KIND_FD:
>> + error_setg(errp, "Unsupported socket address type 'fd'");
>> + return -1;
>> +
>> default:
>> - error_setg(errp, "Unknown socket address kind");
>> - return -1;
>> + abort();
>> }
>> }
>
> Just repeating my v1 comments - this needs to be treating KIND_FD as a no-op,
> rather than raising an error.
Do you want to write a patch? Markus is on vacation and since this is
not a regression, dropping this patch from my queue wouldn't do any good
either.
Max
signature.asc
Description: OpenPGP digital signature