]> granicus.if.org Git - libevent/commitdiff
better conversion; cannot use event_err here.
authorNiels Provos <provos@gmail.com>
Sat, 3 Mar 2007 08:27:52 +0000 (08:27 +0000)
committerNiels Provos <provos@gmail.com>
Sat, 3 Mar 2007 08:27:52 +0000 (08:27 +0000)
svn:r344

evrpc.h

diff --git a/evrpc.h b/evrpc.h
index 86ea933ca6ca3f05aa049acaca7abfde636fa192..86a6bd83ee21fd30886509d73c48b6a44f54bf8f 100644 (file)
--- a/evrpc.h
+++ b/evrpc.h
@@ -192,8 +192,10 @@ int evrpc_send_request_##rpcname(struct evrpc_pool *pool, \
 #define EVRPC_REGISTER_OBJECT(rpc, name, request, reply) \
   do { \
     (rpc)->uri = strdup(#name); \
-    if ((rpc)->uri == NULL) \
-      event_err(1, "failed to register object"); \
+    if ((rpc)->uri == NULL) {                   \
+      fprintf(stderr, "failed to register object\n");  \
+      exit(1);                                         \
+    } \
     (rpc)->request_new = (void *(*)(void))request##_new; \
     (rpc)->request_free = (void (*)(void *))request##_free; \
     (rpc)->request_unmarshal = (int (*)(void *, struct evbuffer *))request##_unmarshal; \
@@ -201,7 +203,7 @@ int evrpc_send_request_##rpcname(struct evrpc_pool *pool, \
     (rpc)->reply_free = (void (*)(void *))reply##_free; \
     (rpc)->reply_complete = (int (*)(void *))reply##_complete; \
     (rpc)->reply_marshal = (void (*)(struct evbuffer*, void *))reply##_marshal; \
-  } while(0)
+  } while (0)
 
 struct evrpc_base;
 struct evhttp;
@@ -212,7 +214,7 @@ struct evrpc_base *evrpc_init(struct evhttp *server);
 /* this macro is used to register RPCs with the HTTP Server */
 #define EVRPC_REGISTER(base, name, request, reply, callback, cbarg) \
   do { \
-    struct evrpc* rpc = calloc(1, sizeof(struct evrpc)); \
+    struct evrpc* rpc = (struct evrpc *)calloc(1, sizeof(struct evrpc)); \
     EVRPC_REGISTER_OBJECT(rpc, name, request, reply); \
     evrpc_register_rpc(base, rpc, \
        (void (*)(struct evrpc_req_generic*, void *))callback, cbarg);  \