[libvirt] [PATCH 03/21] tests: qemuxml2argv: add va_arg enum handling
Cole Robinson
crobinso at redhat.com
Thu Mar 21 16:52:35 UTC 2019
On 3/19/19 7:36 AM, Andrea Bolognani wrote:
> On Thu, 2019-03-14 at 10:43 -0400, Cole Robinson wrote:
> [...]
>> +typedef enum {
>> + ARG_QEMU_CAPS = 1,
>
> Any specific reason to start from 1 rather than 0, or even leaving
> out the start value entirely?
>
Nope it's not necessary, I've dropped it. I think it was left over from
earlier patch state
>> +
>> + ARG_END = QEMU_CAPS_LAST,
>> +} testInfoArgNames;
>
> The name of the enum should be singular, otherwise it will look
> weird when you declare a variable of the type, like...
>
>> static int
>> testInfoSetArgs(struct testInfo *info, ...)
>> {
>> va_list argptr;
>> - int ret = 0;
>> + testInfoArgNames argname;
>
> ... here.
>
> [...]
>> + while ((argname = va_arg(argptr, int)) < ARG_END) {
>> + switch (argname) {
>
> I think you should either call va_arg() with testInfoArgNames as the
> second argument, or make the argname variable int and then have an
> explicit cast in the switch().
>
I went with the former
Thanks,
Cole
More information about the libvir-list
mailing list