All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] eap: avoid nested functions
@ 2021-05-14 16:34 Marc-Antoine Perennou
  2021-05-14 16:34 ` [PATCH 2/2] ap: update for new _auto_ destructors Marc-Antoine Perennou
  2021-05-17 15:42 ` [PATCH 1/2] eap: avoid nested functions Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Marc-Antoine Perennou @ 2021-05-14 16:34 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
---
 src/eap.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/eap.c b/src/eap.c
index 0645be47..53e35b5e 100644
--- a/src/eap.c
+++ b/src/eap.c
@@ -416,6 +416,8 @@ 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(wanted) ((type == wanted) || IS_EXPANDED_RESPONSE(0, wanted))
+
 static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
 				size_t len)
 {
@@ -428,14 +430,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;
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ap: update for new _auto_ destructors
  2021-05-14 16:34 [PATCH 1/2] eap: avoid nested functions Marc-Antoine Perennou
@ 2021-05-14 16:34 ` Marc-Antoine Perennou
  2021-05-14 16:35   ` keruspe+ml01
  2021-05-17 15:42 ` [PATCH 1/2] eap: avoid nested functions Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Marc-Antoine Perennou @ 2021-05-14 16:34 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
---
 src/ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ap.c b/src/ap.c
index 7eac07d7..82bdf34d 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -3298,7 +3298,7 @@ static struct l_dbus_message *ap_dbus_start_profile(struct l_dbus *dbus,
 {
 	struct ap_if_data *ap_if = user_data;
 	const char *ssid;
-	_auto_(l_settings_free) struct l_settings *config = NULL;
+	_auto_(l_settings) config = NULL;
 	char *config_path;
 	int err;
 
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ap: update for new _auto_ destructors
  2021-05-14 16:34 ` [PATCH 2/2] ap: update for new _auto_ destructors Marc-Antoine Perennou
@ 2021-05-14 16:35   ` keruspe+ml01
  0 siblings, 0 replies; 4+ messages in thread
From: keruspe+ml01 @ 2021-05-14 16:35 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 79 bytes --]

Heh, sorry, this one is supposed to be in another batch, off-by-one on my side.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] eap: avoid nested functions
  2021-05-14 16:34 [PATCH 1/2] eap: avoid nested functions Marc-Antoine Perennou
  2021-05-14 16:34 ` [PATCH 2/2] ap: update for new _auto_ destructors Marc-Antoine Perennou
@ 2021-05-17 15:42 ` Denis Kenzior
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2021-05-17 15:42 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

Hi Marc-Antoine,

On 5/14/21 11:34 AM, Marc-Antoine Perennou wrote:
> Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>

No Signed-off-by please

> ---
>   src/eap.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/src/eap.c b/src/eap.c
> index 0645be47..53e35b5e 100644
> --- a/src/eap.c
> +++ b/src/eap.c
> @@ -416,6 +416,8 @@ 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(wanted) ((type == wanted) || IS_EXPANDED_RESPONSE(0, 

Would it be safer to add '()' around wanted in at least the type == comparison?

wanted))
> +
>   static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
>   				size_t len)
>   {
> @@ -428,14 +430,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;
> 

Regards,
-Denis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-17 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 16:34 [PATCH 1/2] eap: avoid nested functions Marc-Antoine Perennou
2021-05-14 16:34 ` [PATCH 2/2] ap: update for new _auto_ destructors Marc-Antoine Perennou
2021-05-14 16:35   ` keruspe+ml01
2021-05-17 15:42 ` [PATCH 1/2] eap: avoid nested functions Denis Kenzior

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.