* Re: [PATCH] eap: Remove nested function use
@ 2021-11-08 17:14 Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-11-08 17:14 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
Hi Marc-Antoine,
On 11/6/21 2:34 PM, Marc-Antoine Perennou wrote:
> This allows building iwd with clang
>
> Signed-off-by: Marc-Antoine Perennou <Marc-Antoine(a)Perennou.com>
We do not use S-o-b tags, so I dropped this.
> ---
> src/eap.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] eap: Remove nested function use
@ 2021-11-06 19:34 Marc-Antoine Perennou
0 siblings, 0 replies; 2+ messages in thread
From: Marc-Antoine Perennou @ 2021-11-06 19:34 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]
This allows building iwd with clang
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine(a)Perennou.com>
---
src/eap.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/src/eap.c b/src/eap.c
index 0645be47..10381af7 100644
--- a/src/eap.c
+++ b/src/eap.c
@@ -416,6 +416,9 @@ static const char *eap_type_to_str(enum eap_type type, uint32_t vendor_id,
#define IS_EXPANDED_RESPONSE(id, t) \
(type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t))
+#define RESPONSE_IS(t) \
+ (type == (t) || IS_EXPANDED_RESPONSE(0, (t)))
+
static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
size_t len)
{
@@ -428,14 +431,6 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
eap->method->vendor_id[2];
uint32_t our_vendor_type = eap->method->vendor_type;
- bool response_is(enum eap_type wanted)
- {
- if (type == wanted)
- return true;
-
- return IS_EXPANDED_RESPONSE(0, wanted);
- }
-
if (len < 1)
/* Invalid packets to be ignored */
return;
@@ -461,7 +456,7 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
return;
}
- if (response_is(EAP_TYPE_NAK)) {
+ if (RESPONSE_IS(EAP_TYPE_NAK)) {
l_debug("EAP peer not configured for method: %s",
eap_type_to_str(our_type, our_vendor_id,
our_vendor_type));
@@ -500,7 +495,7 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
*/
if (!eap->identity) {
- if (!response_is(EAP_TYPE_IDENTITY))
+ if (!RESPONSE_IS(EAP_TYPE_IDENTITY))
goto unsupported_method;
/*
@@ -528,7 +523,7 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
* (with the exception of the Nak)
*/
if (our_type != EAP_TYPE_EXPANDED) {
- if (response_is(our_type))
+ if (RESPONSE_IS(our_type))
goto handle_response;
} else if (IS_EXPANDED_RESPONSE(our_vendor_id, our_vendor_type))
goto handle_response;
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-08 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 17:14 [PATCH] eap: Remove nested function use Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2021-11-06 19:34 Marc-Antoine Perennou
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.