From 48ef354366a0cdc201027b304e712725d2557635 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Fri, 15 Aug 2014 19:09:59 +0100 Subject: [PATCH] use explicit event done return type in all handler methods --- include/tr/comm_manager.h | 4 ++-- src/comm_manager.c | 17 +++++++++-------- src/comm_manager_shutdown.c | 4 ++-- src/connector.c | 4 ++-- src/i_comm_manager.c | 27 ++++++++++++++------------- src/io_handler.c | 8 ++++---- src/protocol_handler.c | 12 ++++++------ 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/include/tr/comm_manager.h b/include/tr/comm_manager.h index 968e1de..0c4297d 100644 --- a/include/tr/comm_manager.h +++ b/include/tr/comm_manager.h @@ -42,8 +42,8 @@ TR_CLASSVARS_DECL(TR_CommManager) { TR_CV_EXTENDS(TR_EventHandler); }; -void TR_commManagerAddEndpoint(void *, TR_CommEndPoint); -int TR_commManagerShutdown(void * _this, TR_Event event); +void TR_commManagerAddEndpoint(void *, TR_CommEndPoint); +TR_EventDone TR_commManagerShutdown(void * _this, TR_Event event); #endif // __TR_COMM_MANAGER_H__ diff --git a/src/comm_manager.c b/src/comm_manager.c index 313bf19..25500e7 100644 --- a/src/comm_manager.c +++ b/src/comm_manager.c @@ -59,21 +59,22 @@ commManagerDtor(void * _this) } static -int +TR_EventDone TR__commManagerAddEndpoint(void * _this, TR_Event event) { TR_commManagerAddEndpoint( (TR_CommManager)_this, (TR_CommEndPoint)event->subject); - return 1; + + return TR_EVENT_DONE; } -void TR_commManagerSelect(void *, TR_Event, int); -void TR_commManagerEnableWrite(void *, TR_Event); -void TR_commManagerDisableWrite(void *, TR_Event); -void TR_commManagerClose(void *, TR_Event); -void TR_commManagerShutdownRead(void *, TR_Event); -void TR_commManagerShutdownWrite(void *, TR_Event); +TR_EventDone TR_commManagerSelect(void *, TR_Event, int); +TR_EventDone TR_commManagerEnableWrite(void *, TR_Event); +TR_EventDone TR_commManagerDisableWrite(void *, TR_Event); +TR_EventDone TR_commManagerClose(void *, TR_Event); +TR_EventDone TR_commManagerShutdownRead(void *, TR_Event); +TR_EventDone TR_commManagerShutdownWrite(void *, TR_Event); static void diff --git a/src/comm_manager_shutdown.c b/src/comm_manager_shutdown.c index a47a9a9..3c84b2e 100644 --- a/src/comm_manager_shutdown.c +++ b/src/comm_manager_shutdown.c @@ -28,7 +28,7 @@ #include "tr/comm_manager.h" -int +TR_EventDone TR_commManagerShutdown(void * _this, TR_Event event) { TR_CommManager this = _this; @@ -45,7 +45,7 @@ TR_commManagerShutdown(void * _this, TR_Event event) } } - return 0; + return TR_EVENT_DONE; } // vim: set ts=4 sw=4: diff --git a/src/connector.c b/src/connector.c index 02de626..8384c9e 100644 --- a/src/connector.c +++ b/src/connector.c @@ -50,7 +50,7 @@ connectorDtor(void * _this) } static -int +TR_EventDone connectorAccept(void * _this, TR_Event event) { TR_Connector this = _this; @@ -78,7 +78,7 @@ connectorAccept(void * _this, TR_Event event) * TODO we need to identify socket failures and close socket then. */ - return 1; + return TR_EVENT_DONE; } static diff --git a/src/i_comm_manager.c b/src/i_comm_manager.c index 35574dc..245a958 100644 --- a/src/i_comm_manager.c +++ b/src/i_comm_manager.c @@ -47,7 +47,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint) TR_CALL(_this, TR_CommManager, addEndpoint, endpoint); } -int +TR_EventDone TR_commManagerSelect(void * _this, TR_Event event) { int timeout; // milliseconds @@ -62,17 +62,19 @@ TR_commManagerSelect(void * _this, TR_Event event) } TR_CALL(_this, TR_CommManager, select, event, timeout); - return 1; + + return TR_EVENT_DONE; } -int +TR_EventDone TR_commManagerEnableWrite(void * _this, TR_Event event) { TR_CALL(_this, TR_CommManager, enableWrite, event); - return 1; + + return TR_EVENT_DONE; } -int +TR_EventDone TR_commManagerDisableWrite(void * _this, TR_Event event) { TR_EventHandler this = _this; @@ -89,10 +91,10 @@ TR_commManagerDisableWrite(void * _this, TR_Event event) NULL)); } - return 1; + return TR_EVENT_DONE; } -int +TR_EventDone TR_commManagerClose(void * _this, TR_Event event) { TR_CommManager this = _this; @@ -102,10 +104,10 @@ TR_commManagerClose(void * _this, TR_Event event) TR_CALL(_this, TR_CommManager, close, event); TR_delete(this->endpoints[endpoint->transport->handle]); - return 0; + return TR_EVENT_DONE; } -int +TR_EventDone TR_commManagerShutdownRead(void * _this, TR_Event event) { TR_CALL(_this, TR_CommManager, shutdownRead, event); @@ -130,10 +132,10 @@ TR_commManagerShutdownRead(void * _this, TR_Event event) TR_cepSetClose((TR_CommEndPoint)event->subject); } - return 0; + return TR_EVENT_DONE; } -int +TR_EventDone TR_commManagerShutdownWrite(void * _this, TR_Event event) { TR_CALL(_this, TR_CommManager, shutdownWrite, event); @@ -147,8 +149,7 @@ TR_commManagerShutdownWrite(void * _this, TR_Event event) NULL)); } - return 0; + return TR_EVENT_DONE; } - // vim: set ts=4 sw=4: diff --git a/src/io_handler.c b/src/io_handler.c index a02a462..e45ed00 100644 --- a/src/io_handler.c +++ b/src/io_handler.c @@ -41,7 +41,7 @@ ioHandlerCtor(void * _this, va_list * params) static void ioHandlerDtor(void * _this) {} static -int +TR_EventDone ioHandlerRead(void * _this, TR_Event event) { TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; @@ -79,11 +79,11 @@ ioHandlerRead(void * _this, TR_Event event) break; } - return TRUE; + return TR_EVENT_DONE; } static -int +TR_EventDone ioHandlerWrite(void * _this, TR_Event event) { TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; @@ -106,7 +106,7 @@ ioHandlerWrite(void * _this, TR_Event event) TR_eventHandlerIssueEvent((TR_EventHandler)_this, event); } - return TRUE; + return TR_EVENT_DONE; } static diff --git a/src/protocol_handler.c b/src/protocol_handler.c index 10f7381..d39512b 100644 --- a/src/protocol_handler.c +++ b/src/protocol_handler.c @@ -44,7 +44,7 @@ protocolHandlerCtor(void * _this, va_list * params) static void protocolHandlerDtor(void * _this) {} static -int +TR_EventDone protocolHandlerParse(void * _this, TR_Event event) { /** @@ -68,11 +68,11 @@ protocolHandlerParse(void * _this, TR_Event event) } } - return TRUE; + return TR_EVENT_DONE; } static -int +TR_EventDone protocolHandlerCompose(void * _this, TR_Event event) { TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; @@ -94,13 +94,13 @@ protocolHandlerCompose(void * _this, TR_Event event) TR_delete(message); } - return TRUE; + return TR_EVENT_DONE; } -int +TR_EventDone protocolHandlerUpgrade(void * _this, TR_Event event) { - return TRUE; + return TR_EVENT_DONE; } static