From 59d47bc7dadb22ec7bf60ae9ae59fdf5616416d9 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Sun, 13 May 2012 19:15:44 +0000 Subject: [PATCH] Add MIN/MAX declarations in nfc-internal.h and nfc-utils.h Remove the now useless #include --- libnfc/buses/uart_posix.c | 1 - libnfc/chips/pn53x.c | 2 -- libnfc/drivers/acr122s.c | 1 - libnfc/drivers/arygon.c | 1 - libnfc/nfc-internal.h | 7 +++++++ libnfc/nfc.c | 2 -- utils/nfc-list.c | 1 - utils/nfc-probe.c | 1 - utils/nfc-read-forum-tag3.c | 1 - utils/nfc-utils.h | 7 +++++++ 10 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libnfc/buses/uart_posix.c b/libnfc/buses/uart_posix.c index 3c7e680..db689d6 100644 --- a/libnfc/buses/uart_posix.c +++ b/libnfc/buses/uart_posix.c @@ -28,7 +28,6 @@ /* vim: set ts=2 sw=2 et: */ #include -#include #include #include #include diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index d90876a..284c4e8 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -35,8 +35,6 @@ #include #include -#include - #include "nfc/nfc.h" #include "nfc-internal.h" #include "pn53x.h" diff --git a/libnfc/drivers/acr122s.c b/libnfc/drivers/acr122s.c index dd20a21..2718963 100644 --- a/libnfc/drivers/acr122s.c +++ b/libnfc/drivers/acr122s.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index 388143a..a7e4c81 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h index 372e79c..6f1e579 100644 --- a/libnfc/nfc-internal.h +++ b/libnfc/nfc-internal.h @@ -45,6 +45,13 @@ return false; \ } +#ifndef MIN +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef MAX +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#endif + /* * Buffer management macros. * diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 1038fff..78f1538 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -78,8 +78,6 @@ #include "nfc-internal.h" #include "drivers.h" -#include - #define LOG_CATEGORY "libnfc.general" const struct nfc_driver *nfc_drivers[] = { diff --git a/utils/nfc-list.c b/utils/nfc-list.c index 00daecc..b22c3a5 100644 --- a/utils/nfc-list.c +++ b/utils/nfc-list.c @@ -39,7 +39,6 @@ #ifdef HAVE_LIBUSB # ifdef DEBUG -# include # include # endif #endif diff --git a/utils/nfc-probe.c b/utils/nfc-probe.c index 866bc02..650b573 100644 --- a/utils/nfc-probe.c +++ b/utils/nfc-probe.c @@ -39,7 +39,6 @@ #ifdef HAVE_LIBUSB # ifdef DEBUG -# include # include # endif #endif diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index 72d9ee5..8586cf1 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -49,7 +49,6 @@ #include #include #include -#include #include #include diff --git a/utils/nfc-utils.h b/utils/nfc-utils.h index 4e5c41f..d039544 100644 --- a/utils/nfc-utils.h +++ b/utils/nfc-utils.h @@ -79,6 +79,13 @@ # define ERR(...) warnx ("ERROR: " __VA_ARGS__ ) #endif +#ifndef MIN +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef MAX +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#endif + uint8_t oddparity (const uint8_t bt); void oddparity_bytes_ts (const uint8_t *pbtData, const size_t szLen, uint8_t *pbtPar);