[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 2/8] ui: convert the SDL2 frontend to keycodemapd
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PULL 2/8] ui: convert the SDL2 frontend to keycodemapdb |
Date: |
Thu, 1 Feb 2018 12:37:26 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/02/2018 12:35, Daniel P. Berrangé wrote:
> On Thu, Feb 01, 2018 at 12:28:02PM -0500, Paolo Bonzini wrote:
>> On 25/01/2018 09:32, Gerd Hoffmann wrote:
>>> --- a/include/ui/input.h
>>> +++ b/include/ui/input.h
>>> @@ -80,4 +80,7 @@ extern const guint16 qemu_input_map_qnum_to_qcode[];
>>> extern const guint qemu_input_map_qcode_to_linux_len;
>>> extern const guint16 qemu_input_map_qcode_to_linux[];
>>
>> Is there any reason to use the length variables rather than just
>> ARRAY_SIZE()? Coverity isn't able to see through the initializer and
>> incorrectly complains that
>
> ARRAY_SIZE can only be used if you can see the array variable
> initialization, but this is the header file so all we have is
> the extern declaration and thus the array size is unknown from
> the places that need to use the _len variable.
>
> We do in fact initalize the _len variable based on the ARRAY_SIZE,
> but that's in the .c files.
Would it make sense for keymap-gen to also generate the header file, so
that we can use an "extern const guint x[NNN]" declaration rather
instead of "x[]"?
Thanks,
Paolo