summaryrefslogtreecommitdiff
path: root/librabbitmq/codegen.py
diff options
context:
space:
mode:
authorDavid Wragg <david@rabbitmq.com>2011-01-14 01:32:12 +0000
committerDavid Wragg <david@rabbitmq.com>2011-01-14 01:32:12 +0000
commit61f1fc5ae633b9e5509e741e90d3aece37bc8f87 (patch)
treed07d1cf89614c5216d483ccede59ee61100223df /librabbitmq/codegen.py
parent68e635a59583da19d7289be2eac040cf4eff328b (diff)
downloadrabbitmq-c-github-ask-bug23645.tar.gz
Extract common code from generated API functionsbug23645
Diffstat (limited to 'librabbitmq/codegen.py')
-rw-r--r--librabbitmq/codegen.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/librabbitmq/codegen.py b/librabbitmq/codegen.py
index cded64a..b52cf3b 100644
--- a/librabbitmq/codegen.py
+++ b/librabbitmq/codegen.py
@@ -493,13 +493,9 @@ int amqp_encode_properties(uint16_t class_id,
if info is False:
continue
- reply = cConstantName(c_ize(m.klass.name) + '_' + c_ize(m.name)
- + "_ok_method")
-
print
print m.apiPrototype()
print "{"
- print " amqp_method_number_t replies[2] = { %s, 0};" % (reply,)
print " %s req;" % (m.structName(),)
for f in m.arguments:
@@ -517,16 +513,12 @@ int amqp_encode_properties(uint16_t class_id,
print " req.%s = %s;" % (n, val)
+ reply = cConstantName(c_ize(m.klass.name) + '_' + c_ize(m.name)
+ + "_ok_method")
print """
- state->most_recent_api_result = amqp_simple_rpc(state, channel,
- %s,
- replies, &req);
- if (state->most_recent_api_result.reply_type == AMQP_RESPONSE_NORMAL)
- return state->most_recent_api_result.reply.decoded;
- else
- return NULL;
+ return amqp_simple_rpc_decoded(state, channel, %s, %s, &req);
}
-""" % (m.defName(),)
+""" % (m.defName(), reply)
def genHrl(spec):
def fieldDeclList(fields):