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

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@googlemail.com> +# Copyright (C) 2013 Ata E Husain Bohra <ata.husain@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

ping ...
From: ata.husain@hotmail.com To: libvir-list@redhat.com CC: ata.husain@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@googlemail.com> +# Copyright (C) 2013 Ata E Husain Bohra <ata.husain@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

2013/1/2 Ata E Husain Bohra <ata.husain@hotmail.com>:
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@googlemail.com> +# Copyright (C) 2013 Ata E Husain Bohra <ata.husain@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"
ACK for the general idea of the fix, but there is already a generate_dispatch function that does what you reimplemented in recurse_dispatch. I removed recurse_dispatch, replaced the call to it with a call to generate_dispatch and pushed the result. -- Matthias Bolte http://photron.blogspot.com

Thanks !
Date: Wed, 1 May 2013 14:27:08 +0200 Subject: Re: [libvirt] [PATCH] ESX: Fix DISPATCH_FREE generation code to free all extended objects From: matthias.bolte@googlemail.com To: ata.husain@hotmail.com CC: libvir-list@redhat.com
2013/1/2 Ata E Husain Bohra <ata.husain@hotmail.com>:
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@googlemail.com> +# Copyright (C) 2013 Ata E Husain Bohra <ata.husain@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"
ACK for the general idea of the fix, but there is already a generate_dispatch function that does what you reimplemented in recurse_dispatch.
I removed recurse_dispatch, replaced the call to it with a call to generate_dispatch and pushed the result.
-- Matthias Bolte http://photron.blogspot.com
participants (3)
-
Ata Bohra
-
Ata E Husain Bohra
-
Matthias Bolte