[libvirt] [PATCH 1/3] qemu: simplify switch case for blockjob events

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Oct 6 07:27:13 UTC 2016



On 05.10.2016 17:36, Jiri Denemark wrote:
> On Wed, Oct 05, 2016 at 16:52:08 +0300, Nikolay Shirokovskiy wrote:
>> ---
>>  src/qemu/qemu_monitor_json.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
>> index e1494df..6c2884d 100644
>> --- a/src/qemu/qemu_monitor_json.c
>> +++ b/src/qemu/qemu_monitor_json.c
>> @@ -841,10 +841,8 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>>      case VIR_DOMAIN_BLOCK_JOB_CANCELED:
>>      case VIR_DOMAIN_BLOCK_JOB_READY:
>>          break;
>> -    case VIR_DOMAIN_BLOCK_JOB_FAILED:
>> -    case VIR_DOMAIN_BLOCK_JOB_LAST:
>> -        VIR_DEBUG("should not get here");
>> -        break;
>> +    default:
>> +        VIR_WARN("unexpected block job type: %d", event);
>>      }
> 
> NACK, we intentionally don't use default branches. Default switch
> branch disables GCC warnings in case any enum item is not handled.
> 
> Runtime warnings are invisible while compile time warnings are very easy
> to spot.
> 

Ok, thanks for the explanation. Let's drop it.

Nikolay




More information about the libvir-list mailing list