This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 7bc7b611d693ae3b1cc1befc45c0b6bc42b30def Author: Juha Niskanen <juha.niska...@haltian.com> AuthorDate: Tue Dec 8 18:33:49 2020 +0200 arch/arm/src/lc823450: fully parenthesize MIN and MAX macros Signed-off-by: Juha Niskanen <juha.niska...@haltian.com> --- arch/arm/src/lc823450/lc823450_mpuinit2.c | 4 ++-- arch/arm/src/lc823450/lc823450_procfs_dvfs.c | 5 +++-- arch/arm/src/lc823450/lc823450_serial.c | 6 +----- arch/arm/src/lc823450/lc823450_spi.c | 2 +- arch/arm/src/lc823450/lc823450_usbdev.c | 6 +----- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/arch/arm/src/lc823450/lc823450_mpuinit2.c b/arch/arm/src/lc823450/lc823450_mpuinit2.c index 51f71aa..f40cc86 100644 --- a/arch/arm/src/lc823450/lc823450_mpuinit2.c +++ b/arch/arm/src/lc823450/lc823450_mpuinit2.c @@ -39,11 +39,11 @@ ****************************************************************************/ #ifndef MAX -# define MAX(a,b) a > b ? a : b +# define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef MIN -# define MIN(a,b) a < b ? a : b +# define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif /**************************************************************************** diff --git a/arch/arm/src/lc823450/lc823450_procfs_dvfs.c b/arch/arm/src/lc823450/lc823450_procfs_dvfs.c index bd3e597..8d5d6ce 100644 --- a/arch/arm/src/lc823450/lc823450_procfs_dvfs.c +++ b/arch/arm/src/lc823450/lc823450_procfs_dvfs.c @@ -56,7 +56,7 @@ #define DVFS_LINELEN 128 #ifndef MIN -# define MIN(a,b) (a < b ? a : b) +# define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #ifndef CONFIG_SMP_NCPUS @@ -286,7 +286,8 @@ static ssize_t dvfs_write(FAR struct file *filep, FAR const char *buffer, strncpy(line, buffer, n); line[n] = '\0'; - n = MIN(strcspn(line, " "), sizeof(cmd) - 1); + n = strcspn(line, " "); + n = MIN(n, sizeof(cmd) - 1); strncpy(cmd, line, n); cmd[n] = '\0'; diff --git a/arch/arm/src/lc823450/lc823450_serial.c b/arch/arm/src/lc823450/lc823450_serial.c index 6e83ee1..03a06ad 100644 --- a/arch/arm/src/lc823450/lc823450_serial.c +++ b/arch/arm/src/lc823450/lc823450_serial.c @@ -141,12 +141,8 @@ int g_console_disable; # define HS_DMAACT_ACT2 3 #endif -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? a : b) -#endif - #ifndef MIN -#define MIN(a, b) ((a) > (b) ? b : a) +# define MIN(a, b) ((a) > (b) ? (b) : (a)) #endif /**************************************************************************** diff --git a/arch/arm/src/lc823450/lc823450_spi.c b/arch/arm/src/lc823450/lc823450_spi.c index 2a99d6d..8781c50 100644 --- a/arch/arm/src/lc823450/lc823450_spi.c +++ b/arch/arm/src/lc823450/lc823450_spi.c @@ -53,7 +53,7 @@ #endif #ifndef MIN -# define MIN(a, b) ((a) > (b) ? b : a) +# define MIN(a, b) ((a) > (b) ? (b) : (a)) #endif /**************************************************************************** diff --git a/arch/arm/src/lc823450/lc823450_usbdev.c b/arch/arm/src/lc823450/lc823450_usbdev.c index 4d603a0..8c8bd24 100644 --- a/arch/arm/src/lc823450/lc823450_usbdev.c +++ b/arch/arm/src/lc823450/lc823450_usbdev.c @@ -75,11 +75,7 @@ #ifndef MIN # define MIN(a, b) ((a) > (b) ? (b) : (a)) -#endif /* MIN */ - -#ifndef MAX -# define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif /* MIN */ +#endif #if 0 # define DPRINTF(fmt, args...) uinfo(fmt, ##args)