[PATCH] Fix MIN() macro

Baligh Gasmi gasmibal at gmail.com
Thu Mar 17 05:18:34 PDT 2022


Fix macro and avoid macro definition within function.

Signed-off-by: Baligh Gasmi <bgasmi at freebox.fr>
---
 wpa_supplicant/scan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index b0094ca6c..4265f25ee 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -24,6 +24,9 @@
 #include "scan.h"
 #include "mesh.h"
 
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
 
 static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
 {
@@ -2046,12 +2049,10 @@ struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
 	return buf;
 }
 
-
 /* Compare function for sorting scan results. Return >0 if @b is considered
  * better. */
 static int wpa_scan_result_compar(const void *a, const void *b)
 {
-#define MIN(a,b) a < b ? a : b
 	struct wpa_scan_res **_wa = (void *) a;
 	struct wpa_scan_res **_wb = (void *) b;
 	struct wpa_scan_res *wa = *_wa;
@@ -2116,7 +2117,6 @@ static int wpa_scan_result_compar(const void *a, const void *b)
 	if (snr_b_full == snr_a_full)
 		return wb->qual - wa->qual;
 	return snr_b_full - snr_a_full;
-#undef MIN
 }
 
 
-- 
2.35.1




More information about the Hostap mailing list