qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 02/16] sockets: move qapi_copy_SocketAddress


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 02/16] sockets: move qapi_copy_SocketAddress into qemu-sockets.c
Date: Mon, 19 Oct 2015 16:05:03 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/12/2015 05:14 AM, Daniel P. Berrange wrote:
> The qapi_copy_SocketAddress method is going to be useful
> in more places than just qemu-char.c, so move it into
> the qemu-sockets.c file to allow its reuse.
> 
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
>  include/qemu/sockets.h |  4 ++++
>  qemu-char.c            | 25 -------------------------
>  util/qemu-sockets.c    | 30 ++++++++++++++++++++++++++++++
>  3 files changed, 34 insertions(+), 25 deletions(-)
> 

> +++ b/qemu-char.c
> @@ -92,31 +92,6 @@
>  
>  /***********************************************************/
>  /* Socket address helpers */
> -static void qapi_copy_SocketAddress(SocketAddress **p_dest,
> -                                    SocketAddress *src)
> -{
> -    QmpOutputVisitor *qov;
> -    QmpInputVisitor *qiv;
> -    Visitor *ov, *iv;
> -    QObject *obj;
> -
> -    *p_dest = NULL;
> -
> -    qov = qmp_output_visitor_new();
> -    ov = qmp_output_get_visitor(qov);
> -    visit_type_SocketAddress(ov, &src, NULL, &error_abort);
> -    obj = qmp_output_get_qobject(qov);
> -    qmp_output_visitor_cleanup(qov);
> -    if (!obj) {
> -        return;
> -    }
> -
> -    qiv = qmp_input_visitor_new(obj);
> -    iv = qmp_input_get_visitor(qiv);
> -    visit_type_SocketAddress(iv, p_dest, NULL, &error_abort);
> -    qmp_input_visitor_cleanup(qiv);
> -    qobject_decref(obj);

Interesting approach - it means that this copy will work no matter what
further extensions we add into the qapi type.  But rather heavyweight
compared to just doing a memberwise copy, no?  At any rate, this commit
is straight code motion, so you did it correctly, but we may want to
simplify things in a later commit.

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]