[libvirt] [RESEND] ESX: Fix DISPATCH_FREE generation code to free all extended objects

Ata Bohra ata.husain at hotmail.com
Mon Feb 25 22:56:07 UTC 2013


ping ...
 > From: ata.husain at hotmail.com
> To: libvir-list at redhat.com
> CC: ata.husain at hotmail.com
> Subject: [PATCH] ESX: Fix DISPATCH_FREE generation code to free all extended objects
> Date: Tue, 1 Jan 2013 22:22:28 -0800
> 
> Python code generator "generate_source" section that handles
> code generation to "free" inherited objects needs to generate
> DISPATCH_FREE calls for all extended_by objects.
> ---
>  src/esx/esx_vi_generator.py |   21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
> index af4e7e8..7a7cf76 100755
> --- a/src/esx/esx_vi_generator.py
> +++ b/src/esx/esx_vi_generator.py
> @@ -4,6 +4,7 @@
>  # esx_vi_generator.py: generates most of the SOAP type mapping code
>  #
>  # Copyright (C) 2010-2012 Matthias Bolte <matthias.bolte at googlemail.com>
> +# Copyright (C) 2013 Ata E Husain Bohra <ata.husain at hotmail.com>
>  #
>  # This library is free software; you can redistribute it and/or
>  # modify it under the terms of the GNU Lesser General Public
> @@ -785,9 +786,7 @@ class Object(Type):
>              source += "ESX_VI__TEMPLATE__DYNAMIC_FREE(%s,\n" % self.name
>              source += "{\n"
> 
> -            for extended_by in self.extended_by:
> -                source += "    ESX_VI__TEMPLATE__DISPATCH__FREE(%s)\n" \
> -                          % extended_by
> +            source += recurse_dispatch(self, "ESX_VI__TEMPLATE__DISPATCH__FREE")
> 
>              source += "},\n"
>              source += "{\n"
> @@ -1285,6 +1284,22 @@ class ManagedObject(Type):
> 
> 
> 
> +def recurse_dispatch(object, text):
> +
> +    source = ""
> +
> +    if object.extended_by is None:
> +        return source
> +
> +    for extended_by in object.extended_by:
> +        source += "    %s(%s)\n" % (text, extended_by)
> +        child = objects_by_name[extended_by]
> +        source += recurse_dispatch(child, text)
> +
> +    return source
> +
> +
> +
>  class Enum(Type):
>      FEATURE__ANY_TYPE = (1 << 1)
>      FEATURE__SERIALIZE = (1 << 2)
> --
> 1.7.9.5
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130225/1d628c3a/attachment-0001.htm>


More information about the libvir-list mailing list