diff options
author | Shuo Chen <giantchen@gmail.com> | 2010-04-14 14:27:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-04-14 14:27:29 -0400 |
commit | 755fbf16c3ce94bfa09e1bf5da27ccdfc1e7e725 (patch) | |
tree | 7818e3b475a31ac3d6677051a73af7632cd735d2 /event_rpcgen.py | |
parent | 07edf784fab4e25c31eef3fdcccec3975e2741db (diff) | |
download | libevent-755fbf16c3ce94bfa09e1bf5da27ccdfc1e7e725.tar.gz |
Add void* arguments to request_new and reply_new evrpc hooks
This makes evprc setup more extensible, and helps with Shuo Chen's
work on implementing Google protocol buffers rpc on top of Libevent 2
evrpc.
This patch breaks binary compatibility with previous versions of
Libevent, since it changes struct evrpc and the signature of
evrpc_register_generic(). Since all compliant code should be calling
evrpc_register_generic via EVRPC_REGISTER, it shouldn't break source
compatibility.
(Code by Shuo Chen; commit message by Nick)
Diffstat (limited to 'event_rpcgen.py')
-rwxr-xr-x | event_rpcgen.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/event_rpcgen.py b/event_rpcgen.py index f8d14d62..9eb75762 100755 --- a/event_rpcgen.py +++ b/event_rpcgen.py @@ -117,6 +117,7 @@ class StructCCode(Struct): print >>file, \ """struct %(name)s *%(name)s_new(void); +struct %(name)s *%(name)s_new_with_arg(void *); void %(name)s_free(struct %(name)s *); void %(name)s_clear(struct %(name)s *); void %(name)s_marshal(struct evbuffer *, const struct %(name)s *); @@ -157,6 +158,12 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t, 'struct %(name)s *\n' '%(name)s_new(void)\n' '{\n' + ' return %(name)s_new_with_arg(NULL);\n' + '}\n' + '\n' + 'struct %(name)s *\n' + '%(name)s_new_with_arg(void *unused)\n' + '{\n' ' struct %(name)s *tmp;\n' ' if ((tmp = malloc(sizeof(struct %(name)s))) == NULL) {\n' ' event_warn("%%s: malloc", __func__);\n' |