mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-25 12:06:33 -04:00
don't require string literal for message name
svn:r270
This commit is contained in:
parent
ff43ed5b33
commit
4aa780d6ad
4
evrpc.h
4
evrpc.h
@ -49,7 +49,7 @@
|
|||||||
*
|
*
|
||||||
* A specific RPC can then be registered with
|
* A specific RPC can then be registered with
|
||||||
*
|
*
|
||||||
* EVRPC_REGISTER(base, "SendCommand", Request, Reply, FunctionCB, arg);
|
* EVRPC_REGISTER(base, SendCommand, Request, Reply, FunctionCB, arg);
|
||||||
*
|
*
|
||||||
* when the server receives an appropriately formatted RPC, the user callback
|
* when the server receives an appropriately formatted RPC, the user callback
|
||||||
* is invokved. The callback needs to fill in the reply structure.
|
* is invokved. The callback needs to fill in the reply structure.
|
||||||
@ -185,7 +185,7 @@ int evrpc_send_request_##rpcname(struct evrpc_pool *pool, \
|
|||||||
/* Takes a request object and fills it in with the right magic */
|
/* Takes a request object and fills it in with the right magic */
|
||||||
#define EVRPC_REGISTER_OBJECT(rpc, name, request, reply) \
|
#define EVRPC_REGISTER_OBJECT(rpc, name, request, reply) \
|
||||||
do { \
|
do { \
|
||||||
(rpc)->uri = strdup(name); \
|
(rpc)->uri = strdup(#name); \
|
||||||
if ((rpc)->uri == NULL) \
|
if ((rpc)->uri == NULL) \
|
||||||
event_err(1, "failed to register object"); \
|
event_err(1, "failed to register object"); \
|
||||||
(rpc)->request_new = (void *(*)(void))request##_new; \
|
(rpc)->request_new = (void *(*)(void))request##_new; \
|
||||||
|
@ -111,7 +111,7 @@ rpc_setup(struct evhttp **phttp, short *pport, struct evrpc_base **pbase)
|
|||||||
http = http_setup(&port);
|
http = http_setup(&port);
|
||||||
base = evrpc_init(http);
|
base = evrpc_init(http);
|
||||||
|
|
||||||
EVRPC_REGISTER(base, "Message", msg, kill, MessageCB, NULL);
|
EVRPC_REGISTER(base, Message, msg, kill, MessageCB, NULL);
|
||||||
|
|
||||||
*phttp = http;
|
*phttp = http;
|
||||||
*pport = port;
|
*pport = port;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user