From c7bc6d9cdbca6bf1643af29d9e2f9286e0dfed0e Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Mon, 18 Jul 2022 09:25:41 +0200 Subject: [PATCH] main: refactor poll_method_best (coverity fix) (#449) --- src/main/method.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/method.c b/src/main/method.c index 7b11fc1a5..4325503f1 100644 --- a/src/main/method.c +++ b/src/main/method.c @@ -24,33 +24,24 @@ static const char str_kqueue[] = "kqueue"; */ enum poll_method poll_method_best(void) { - enum poll_method m = METHOD_NULL; - #ifdef HAVE_EPOLL /* Supported from Linux 2.5.66 */ - if (METHOD_NULL == m) { - m = METHOD_EPOLL; - } + return METHOD_EPOLL; #endif #ifdef HAVE_KQUEUE - if (METHOD_NULL == m) { - m = METHOD_KQUEUE; - } + return METHOD_KQUEUE; #endif #ifdef HAVE_POLL - if (METHOD_NULL == m) { - m = METHOD_POLL; - } + return METHOD_POLL; #endif + #ifdef HAVE_SELECT - if (METHOD_NULL == m) { - m = METHOD_SELECT; - } + return METHOD_SELECT; #endif - return m; + return METHOD_NULL; }