You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/11/22 09:07:53 UTC

[mynewt-nimble] 02/03: Moved min/max macros from global scope in header file to translation unit exlusice c files

This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 32f2ab3ab6dca320ff4b74ab93da2700b7f71d78
Author: timoxd7 <ti...@gmx.de>
AuthorDate: Mon Nov 7 14:53:12 2022 +0100

    Moved min/max macros from global scope in header file to translation unit exlusice c files
---
 nimble/host/src/ble_att.c         | 9 +++++++++
 nimble/host/src/ble_gap.c         | 8 ++++++++
 nimble/host/src/ble_gattc.c       | 9 +++++++++
 nimble/host/src/ble_hs_hci_util.c | 8 ++++++++
 nimble/host/src/ble_sm.c          | 9 +++++++++
 porting/nimble/include/os/os.h    | 8 --------
 porting/nimble/src/os_mbuf.c      | 8 ++++++++
 7 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/nimble/host/src/ble_att.c b/nimble/host/src/ble_att.c
index 5f119ac1..81e08aa0 100644
--- a/nimble/host/src/ble_att.c
+++ b/nimble/host/src/ble_att.c
@@ -23,6 +23,15 @@
 #include "host/ble_att.h"
 
 #if NIMBLE_BLE_CONNECT
+
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
 static uint16_t ble_att_preferred_mtu_val;
 
 /** Dispatch table for incoming ATT requests.  Sorted by op code. */
diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index f7268995..89fc3940 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -27,6 +27,14 @@
 #include "ble_hs_priv.h"
 #include "ble_gap_priv.h"
 
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
 #if MYNEWT
 #include "bsp/bsp.h"
 #else
diff --git a/nimble/host/src/ble_gattc.c b/nimble/host/src/ble_gattc.c
index e4bd0a42..d2b198fa 100644
--- a/nimble/host/src/ble_gattc.c
+++ b/nimble/host/src/ble_gattc.c
@@ -62,6 +62,15 @@
 #include "ble_hs_priv.h"
 
 #if NIMBLE_BLE_CONNECT
+
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
 /*****************************************************************************
  * $definitions / declarations                                               *
  *****************************************************************************/
diff --git a/nimble/host/src/ble_hs_hci_util.c b/nimble/host/src/ble_hs_hci_util.c
index 11d0a77e..cb55469c 100644
--- a/nimble/host/src/ble_hs_hci_util.c
+++ b/nimble/host/src/ble_hs_hci_util.c
@@ -22,6 +22,14 @@
 #include "host/ble_hs_hci.h"
 #include "ble_hs_priv.h"
 
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
 uint16_t
 ble_hs_hci_util_handle_pb_bc_join(uint16_t handle, uint8_t pb, uint8_t bc)
 {
diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c
index 9106d26c..9a66de30 100644
--- a/nimble/host/src/ble_sm.c
+++ b/nimble/host/src/ble_sm.c
@@ -49,6 +49,15 @@
 #include "ble_hs_priv.h"
 
 #if NIMBLE_BLE_CONNECT
+
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
 #if NIMBLE_BLE_SM
 
 /** Procedure timeout; 30 seconds. */
diff --git a/porting/nimble/include/os/os.h b/porting/nimble/include/os/os.h
index f7a7ef9c..da7427f6 100644
--- a/porting/nimble/include/os/os.h
+++ b/porting/nimble/include/os/os.h
@@ -26,14 +26,6 @@
 extern "C" {
 #endif
 
-#ifndef min
-#define min(a, b) ((a)<(b)?(a):(b))
-#endif
-
-#ifndef max
-#define max(a, b) ((a)>(b)?(a):(b))
-#endif
-
 #include "syscfg/syscfg.h"
 #include "nimble/nimble_npl.h"
 
diff --git a/porting/nimble/src/os_mbuf.c b/porting/nimble/src/os_mbuf.c
index cebdb29f..804badc8 100644
--- a/porting/nimble/src/os_mbuf.c
+++ b/porting/nimble/src/os_mbuf.c
@@ -41,6 +41,14 @@
 #include <string.h>
 #include <limits.h>
 
+#ifndef min
+#define min(a, b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+#define max(a, b) ((a)>(b)?(a):(b))
+#endif
+
 /**
  * @addtogroup OSKernel
  * @{