Get rid of multiple MIN macros

There are multiple redundant MIN macro declarations, some of which are
not protecting against side effects. Move it to common.h instead.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
Andrei Otcheretianski 2024-01-10 16:50:27 +02:00 committed by Jouni Malinen
parent 5290523db3
commit abc239a0b0
6 changed files with 7 additions and 25 deletions

View file

@ -20,13 +20,6 @@
#include "ap_drv_ops.h" #include "ap_drv_ops.h"
#include "wmm.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) static inline u8 wmm_aci_aifsn(int aifsn, int acm, int aci)
{ {

View file

@ -76,9 +76,6 @@ static const unsigned long K[64] = {
#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) #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 Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) #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 */ /* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf) static int sha256_compress(struct sha256_state *md, unsigned char *buf)

View file

@ -97,9 +97,6 @@ static const u64 K[80] = {
#define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) #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 Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7))
#define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6)) #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) \ #define ROR64c(x, y) \
( ((((x) & CONST64(0xFFFFFFFFFFFFFFFF)) >> ((u64) (y) & CONST64(63))) | \ ( ((((x) & CONST64(0xFFFFFFFFFFFFFFFF)) >> ((u64) (y) & CONST64(63))) | \

View file

@ -59,14 +59,6 @@
/* from tommath.h */ /* from tommath.h */
#ifndef MIN
#define MIN(x,y) ((x)<(y)?(x):(y))
#endif
#ifndef MAX
#define MAX(x,y) ((x)>(y)?(x):(y))
#endif
#define OPT_CAST(x) #define OPT_CAST(x)
#ifdef __x86_64__ #ifdef __x86_64__

View file

@ -441,6 +441,13 @@ void perror(const char *s);
#define BIT(x) (1U << (x)) #define BIT(x) (1U << (x))
#endif #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 * Definitions for sparse validation
* (http://kernel.org/pub/linux/kernel/people/josh/sparse/) * (http://kernel.org/pub/linux/kernel/people/josh/sparse/)

View file

@ -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, static int wpas_channel_width_tx_pwr(const u8 *ies, size_t ies_len,
enum chan_width cw) enum chan_width cw)
{ {
#define MIN(a, b) (a < b ? a : b)
int offset = wpas_channel_width_offset(cw); int offset = wpas_channel_width_offset(cw);
const struct element *elem; const struct element *elem;
int max_tx_power = TX_POWER_NO_CONSTRAINT, tx_pwr = 0; 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; return max_tx_power;
#undef MIN
} }
@ -2373,7 +2371,6 @@ int wpas_adjust_snr_by_chanwidth(const u8 *ies, size_t ies_len,
* better. */ * better. */
static int wpa_scan_result_compar(const void *a, const void *b) 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 **_wa = (void *) a;
struct wpa_scan_res **_wb = (void *) b; struct wpa_scan_res **_wb = (void *) b;
struct wpa_scan_res *wa = *_wa; 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) if (snr_b_full == snr_a_full)
return wb->qual - wa->qual; return wb->qual - wa->qual;
return snr_b_full - snr_a_full; return snr_b_full - snr_a_full;
#undef MIN
} }