[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] lwip: refactor main demuxer to avoid code duplication
From: |
Joan Lledó |
Subject: |
[PATCH 2/4] lwip: refactor main demuxer to avoid code duplication |
Date: |
Tue, 7 Aug 2018 18:02:41 +0200 |
---
lwip/main.c | 42 +++++++++++-------------------------------
1 file changed, 11 insertions(+), 31 deletions(-)
diff --git a/lwip/main.c b/lwip/main.c
index 9f7eb9b2..4dfbe143 100644
--- a/lwip/main.c
+++ b/lwip/main.c
@@ -99,6 +99,7 @@ int
lwip_demuxer (mach_msg_header_t * inp, mach_msg_header_t * outp)
{
struct port_info *pi;
+ mig_routine_t routine = NULL;
/* Clear errno to prevent raising previous errors again */
errno = 0;
@@ -116,40 +117,19 @@ lwip_demuxer (mach_msg_header_t * inp, mach_msg_header_t
* outp)
if (pi)
{
ports_port_deref (pi);
-
- mig_routine_t routine;
- if ((routine = lwip_io_server_routine (inp)) ||
- (routine = lwip_socket_server_routine (inp)) ||
- (routine = lwip_pfinet_server_routine (inp)) ||
- (routine = lwip_iioctl_server_routine (inp)) ||
- (routine = NULL, trivfs_demuxer (inp, outp)) ||
- (routine = lwip_startup_notify_server_routine (inp)))
- {
- if (routine)
- (*routine) (inp, outp);
- return TRUE;
- }
- else
- return FALSE;
+ routine = lwip_io_server_routine (inp);
}
- else
+
+ if (routine || (routine = lwip_socket_server_routine (inp)) ||
+ (routine = lwip_pfinet_server_routine (inp)) ||
+ (routine = lwip_iioctl_server_routine (inp)) ||
+ (routine = lwip_startup_notify_server_routine (inp)))
{
- mig_routine_t routine;
- if ((routine = lwip_socket_server_routine (inp)) ||
- (routine = lwip_pfinet_server_routine (inp)) ||
- (routine = lwip_iioctl_server_routine (inp)) ||
- (routine = NULL, trivfs_demuxer (inp, outp)) ||
- (routine = lwip_startup_notify_server_routine (inp)))
- {
- if (routine)
- (*routine) (inp, outp);
- return TRUE;
- }
- else
- return FALSE;
+ (*routine) (inp, outp);
+ return TRUE;
}
-
- return 0;
+ else
+ return trivfs_demuxer (inp, outp);
}
void
--
2.17.1
- Patches: lwip translator, Joan Lledó, 2018/08/07
- [PATCH 1/4] lwip: select/poll(): return EIO when POLLERR is set, Joan Lledó, 2018/08/07
- [PATCH 3/4] lwip: return EINTR when a select() IPC thread is cancelled, Joan Lledó, 2018/08/07
- [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication,
Joan Lledó <=
- [PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings, Joan Lledó, 2018/08/07
- Re: Patches: lwip translator, Samuel Thibault, 2018/08/09
- [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication, Joan Lledó, 2018/08/11
- Re: [PATCH 2/4] lwip: refactor main demuxer to avoid code duplication, Samuel Thibault, 2018/08/13
- [PATCH 4/4] lwip: Fix a buffer overflow and clear compiler warnings, Joan Lledó, 2018/08/11