summaryrefslogtreecommitdiffstats
path: root/python_modules/marshal.py
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-07-19 15:47:40 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-20 15:25:49 +0100
commitbcf9b8acf2c567195647c9f6796735630f84c5fb (patch)
tree4fbb64faa76e80197d574020e5b11aa842f151f1 /python_modules/marshal.py
parentbdcfb2c83dd31e1a1fdd75944f632b76504cdb5d (diff)
downloadspice-common-bcf9b8acf2c567195647c9f6796735630f84c5fb.tar.gz
spice-common-bcf9b8acf2c567195647c9f6796735630f84c5fb.tar.xz
spice-common-bcf9b8acf2c567195647c9f6796735630f84c5fb.zip
codegen: Allow @to_ptr to make inline structs demarshal as pointers
Diffstat (limited to 'python_modules/marshal.py')
-rw-r--r--python_modules/marshal.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index cf6ad08..6b894c1 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -87,10 +87,16 @@ class SubMarshallingSource(MarshallingSource):
self.is_helper = False
def get_self_ref(self):
- return "&%s" % self.parent_src.get_ref(self.name)
+ if self.containee.has_attr("to_ptr"):
+ return "%s" % self.parent_src.get_ref(self.name)
+ else:
+ return "&%s" % self.parent_src.get_ref(self.name)
def get_ref(self, member):
- return self.parent_src.get_ref(self.name) + "." + member
+ if self.containee.has_attr("to_ptr"):
+ return self.parent_src.get_ref(self.name) + "->" + member
+ else:
+ return self.parent_src.get_ref(self.name) + "." + member
def write_marshal_ptr_function(writer, target_type):
if target_type.is_array():