qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 06/20] char: use a static array for backends


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 06/20] char: use a static array for backends
Date: Tue, 10 Jan 2017 12:03:18 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/10/2017 11:47 AM, Marc-André Lureau wrote:
> Number and kinds of backends is known at compile-time, use a fixed-sized
> static array to simplify iterations & lookups.

This part is okay;

> Add an alias field to the
> CharDriver structure to cover the cases where we previously registered a
> driver twice under two names.

but this part belongs in the 5/20 commit message.

> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  qemu-char.c | 68 
> ++++++++++++++++++++++++++++++-------------------------------
>  1 file changed, 34 insertions(+), 34 deletions(-)

> @@ -4143,15 +4144,17 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts 
> *opts,
>          goto err;
>      }
>  
> -    for (i = backends; i; i = i->next) {
> -        cd = i->data;
> -
> +    for (i = 0; i < ARRAY_SIZE(backends); i++) {
> +        cd = backends[i];

> @@ -4368,11 +4371,15 @@ qmp_prepend_backend(ChardevBackendInfoList *list, 
> const char *name)
>  ChardevBackendInfoList *qmp_query_chardev_backends(Error **errp)
>  {
>      ChardevBackendInfoList *backend_list = NULL;
> -    CharDriver *c;
> -    GSList *i;
> +    const CharDriver *c;
> +    int i;
> +
> +    for (i = 0; i < ARRAY_SIZE(backends); i++) {
> +        c = backends[i];
> +        if (!c) {

Worth using the name 'cd' everywhere for consistency?

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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