eap: avoid nested functions
PATCH 1/2 eap: avoid nested functions
Signed-off-by Marc-Antoine Perennou <[email protected]>
--- src/eap.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
src/eap.c +2 -8
@@ -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 ;
Signature · 1 line
2.30.0
PATCH 2/2 ap: update for new _auto_ destructors
Signed-off-by Marc-Antoine Perennou <[email protected]>
--- src/ap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/ap.c +1 -1
@@ -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;
Signature · 1 line
2.30.0
Re: [PATCH 2/2] ap: update for new _auto_ destructors
Heh, sorry, this one is supposed to be in another batch, off-by-one on my side.
Hi Marc-Antoine,
Quoted 1 line · Marc-Antoine Perennou
Signed-off-by Marc-Antoine Perennou <[email protected]>
No Signed-off-by please
src/eap.c static const char *eap_type_to_str(enum eap_type type, uint32_t vendor_id, · line 419
Quoted 13 lines
--- src/eap.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)src/eap.c +1
-0@@ -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))
Quoted 10 lines
src/eap.c +1
-1+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)
src/eap.c static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt, · line 435
Quoted 10 lines
src/eap.c +0
-7- { -if (type == wanted) -return true; - -return IS_EXPANDED_RESPONSE (0 , wanted); - } -if (len <1 )/* Invalid packets to be ignored */ return ;
Regards,
-Denis