qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 12/13] vl.c: Remove compile time limit on number


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 12/13] vl.c: Remove compile time limit on number of serial ports
Date: Fri, 20 Apr 2018 19:55:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 20/04/2018 19:06, Peter Maydell wrote:
> On 20 April 2018 at 17:58, Paolo Bonzini <address@hidden> wrote:
>> On 20/04/2018 16:52, Peter Maydell wrote:
>>> Instead of having a fixed sized global serial_hds[] array,
>>> use a local dynamically reallocated one, so we don't have
>>> a compile time limit on how many serial ports a system has.
>>>
>>> Signed-off-by: Peter Maydell <address@hidden>
>>
>> Just one question, would it make sense to use a GPtrArray instead?
> 
> Hmm. Looking at the GPtrArray API there's no API for
> "tell me the length of this pointer array", so we'd still
> have to do the manual bookkeeping for that. And we don't
> need most of the functionality it provides. So it doesn't
> really seem like it gains us much over g_renew() to me.

GPtrArray is a public struct, so you can use array->pdata and
array->len.  There is a disadvantage, which is that you lose type-safety
on dereference.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]