diff options
Diffstat (limited to 'librabbitmq/codegen.py')
-rw-r--r-- | librabbitmq/codegen.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/librabbitmq/codegen.py b/librabbitmq/codegen.py index aa34469..792a6cf 100644 --- a/librabbitmq/codegen.py +++ b/librabbitmq/codegen.py @@ -167,9 +167,12 @@ def genErl(spec): def genDecodeMethodFields(m): print " case %s: {" % (m.defName(),) - print " %s *m = (%s *) amqp_pool_alloc(pool, sizeof(%s));" % \ - (m.structName(), m.structName(), m.structName()) - print " if (m == NULL) { return -ENOMEM; }" + if m.arguments: + print " %s *m = (%s *) amqp_pool_alloc(pool, sizeof(%s));" % \ + (m.structName(), m.structName(), m.structName()) + print " if (m == NULL) { return -ENOMEM; }" + else: + print " %s *m = NULL; /* no fields */" % (m.structName(),) bitindex = None for f in m.arguments: if spec.resolveDomain(f.domain) == 'bit': |