From 0649629483a94a9f74a89a7df13858819489d469 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 28 Nov 2016 18:35:36 -0200 Subject: [PATCH] isisd: use a smaller #ifdef for isis_receive() There's no need to provide two definitions of the isis_receive() function (one for GNU_LINUX and the other for !GNU_LINUX). Both differ only slightly so it makes more sense to define isis_receive() just once and use a smaller #ifdef to account for these differences. This improves code readability. Signed-off-by: Renato Westphal --- isisd/isis_pdu.c | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 1dfb4623f6..39d2df74b6 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -2139,7 +2139,6 @@ isis_handle_pdu (struct isis_circuit *circuit, u_char * ssnpa) return retval; } -#ifdef GNU_LINUX int isis_receive (struct thread *thread) { @@ -2153,10 +2152,11 @@ isis_receive (struct thread *thread) circuit = THREAD_ARG (thread); assert (circuit); + circuit->t_read = NULL; + isis_circuit_stream(circuit, &circuit->rcv_stream); retval = circuit->rx (circuit, ssnpa); - circuit->t_read = NULL; if (retval == ISIS_OK) retval = isis_handle_pdu (circuit, ssnpa); @@ -2166,52 +2166,20 @@ isis_receive (struct thread *thread) */ if (!circuit->is_passive) { +#ifdef GNU_LINUX THREAD_READ_ON (master, circuit->t_read, isis_receive, circuit, circuit->fd); - } - - return retval; -} - #else -int -isis_receive (struct thread *thread) -{ - struct isis_circuit *circuit; - u_char ssnpa[ETH_ALEN]; - int retval; - - /* - * Get the circuit - */ - circuit = THREAD_ARG (thread); - assert (circuit); - - circuit->t_read = NULL; - - isis_circuit_stream(circuit, &circuit->rcv_stream); - - retval = circuit->rx (circuit, ssnpa); - - if (retval == ISIS_OK) - retval = isis_handle_pdu (circuit, ssnpa); - - /* - * prepare for next packet. - */ - if (!circuit->is_passive) - { circuit->t_read = thread_add_timer_msec (master, isis_receive, circuit, listcount (circuit->area->circuit_list) * 100); +#endif } return retval; } -#endif - /* filling of the fixed isis header */ void fill_fixed_hdr (struct isis_fixed_hdr *hdr, u_char pdu_type)