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 <berra...@redhat.com>
> ---
>  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 <ebl...@redhat.com>

-- 
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