@@ -20,13 +20,6 @@
#include "ap_drv_ops.h"
#include "wmm.h"
-#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
static inline u8 wmm_aci_aifsn(int aifsn, int acm, int aci)
{
@@ -76,9 +76,6 @@ static const unsigned long K[64] = {
#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25))
#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
/* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
@@ -97,9 +97,6 @@ static const u64 K[80] = {
#define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41))
#define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7))
#define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6))
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
#define ROR64c(x, y) \
( ((((x) & CONST64(0xFFFFFFFFFFFFFFFF)) >> ((u64) (y) & CONST64(63))) | \
@@ -441,6 +441,13 @@ void perror(const char *s);
#define BIT(x) (1U << (x))
#endif
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+
/*
* Definitions for sparse validation
* (http://kernel.org/pub/linux/kernel/people/josh/sparse/)
@@ -2255,7 +2255,6 @@ static int wpas_channel_width_offset(enum chan_width cw)
static int wpas_channel_width_tx_pwr(const u8 *ies, size_t ies_len,
enum chan_width cw)
{
-#define MIN(a, b) (a < b ? a : b)
int offset = wpas_channel_width_offset(cw);
const struct element *elem;
int max_tx_power = TX_POWER_NO_CONSTRAINT, tx_pwr = 0;
@@ -2331,7 +2330,6 @@ static int wpas_channel_width_tx_pwr(const u8 *ies, size_t ies_len,
}
return max_tx_power;
-#undef MIN
}
@@ -2373,7 +2371,6 @@ int wpas_adjust_snr_by_chanwidth(const u8 *ies, size_t ies_len,
* 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;
@@ -2477,7 +2474,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
}
There are multiple redundant MIN macro declarations, some of which are even wrong. Move it to common.h instead. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> --- src/ap/wmm.c | 7 ------- src/crypto/sha256-internal.c | 3 --- src/crypto/sha512-internal.c | 3 --- src/utils/common.h | 7 +++++++ wpa_supplicant/scan.c | 4 ---- 5 files changed, 7 insertions(+), 17 deletions(-)