From: Timo Kokkonen Date: Fri, 28 Oct 2016 17:33:35 +0000 (+0300) Subject: utils.h: min() max() cleanup X-Git-Url: http://git.itanic.dy.fi/?p=rrdd;a=commitdiff_plain;h=2f8c3bd73c8280b8c4d3579c69f290a56d9e7829 utils.h: min() max() cleanup min() and max() macros belong to utils.h. They should also be lower case, just like the rest of the world tends to have them. Signed-off-by: Timo Kokkonen --- diff --git a/onewire_parser.c b/onewire_parser.c index 834ea9a..effd097 100644 --- a/onewire_parser.c +++ b/onewire_parser.c @@ -215,7 +215,7 @@ undefined: } /* The data from OWNET_read appears to not be NULL terminated */ - memcpy(buf, tmp, MIN(ret, sizeof(buf) -1)); + memcpy(buf, tmp, min(ret, sizeof(buf) -1)); free(tmp); buf[ret] = 0; diff --git a/process.c b/process.c index 1b06e59..98033f0 100644 --- a/process.c +++ b/process.c @@ -9,6 +9,7 @@ #include "process.h" #include "debug.h" +#include "utils.h" static int epoll_fd; static unsigned int max_jobs; @@ -480,7 +481,6 @@ int run_piped_stream(const char *cmd, char *const argv[], * Forks a child and executes a command to run on parallel */ -#define max(a,b) (a) < (b) ? (b) : (a) #define BUF_SIZE (128*1024) int run(const char *cmd, char *const argv[]) { diff --git a/utils.h b/utils.h index 3269e7d..40c212d 100644 --- a/utils.h +++ b/utils.h @@ -1,7 +1,8 @@ #ifndef _UTILS_H_ #define _UTILS_H_ -#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a,b) (a) < (b) ? (b) : (a) #define ARRAY_SIZE(a) (sizeof(a) / (sizeof((a)[0])))