From 6669d8b418c7e483e1f750d354e462082ad695f9 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Fri, 16 Dec 2022 10:28:19 +0530 Subject: [PATCH] Removed min/max instances from more files --- nimble/host/mesh/src/adv.c | 8 ++++++++ nimble/host/mesh/src/cfg_srv.c | 8 ++++++++ nimble/host/mesh/src/glue.c | 8 ++++++++ nimble/host/mesh/src/prov.c | 9 +++++++++ nimble/host/mesh/src/proxy.c | 8 ++++++++ nimble/host/mesh/src/transport.c | 8 ++++++++ nimble/host/src/ble_l2cap_coc.c | 8 ++++++++ 7 files changed, 57 insertions(+) diff --git a/nimble/host/mesh/src/adv.c b/nimble/host/mesh/src/adv.c index b8fb1c7de..9f3c89f5e 100644 --- a/nimble/host/mesh/src/adv.c +++ b/nimble/host/mesh/src/adv.c @@ -41,6 +41,14 @@ static s32_t adv_int_min = ADV_INT_DEFAULT_MS; +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + /* TinyCrypt PRNG consumes a lot of stack space, so we need to have * an increased call stack whenever it's used. */ diff --git a/nimble/host/mesh/src/cfg_srv.c b/nimble/host/mesh/src/cfg_srv.c index 57aac90a3..72099c7f8 100644 --- a/nimble/host/mesh/src/cfg_srv.c +++ b/nimble/host/mesh/src/cfg_srv.c @@ -35,6 +35,14 @@ static struct bt_mesh_cfg_srv *conf; static struct label labels[CONFIG_BT_MESH_LABEL_COUNT]; +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + static int comp_add_elem(struct os_mbuf *buf, struct bt_mesh_elem *elem, bool primary) { diff --git a/nimble/host/mesh/src/glue.c b/nimble/host/mesh/src/glue.c index 7da73d15b..751780ced 100644 --- a/nimble/host/mesh/src/glue.c +++ b/nimble/host/mesh/src/glue.c @@ -39,6 +39,14 @@ extern u8_t g_mesh_addr_type; static struct ble_gap_adv_params ble_adv_cur_conf[2]; #endif +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + const char * bt_hex(const void *buf, size_t len) { diff --git a/nimble/host/mesh/src/prov.c b/nimble/host/mesh/src/prov.c index fe92c0e34..769ebc6ed 100644 --- a/nimble/host/mesh/src/prov.c +++ b/nimble/host/mesh/src/prov.c @@ -194,6 +194,15 @@ struct prov_rx { #define TRANSACTION_TIMEOUT K_SECONDS(30) #define PROTOCOL_TIMEOUT K_SECONDS(60) +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + + #if (MYNEWT_VAL(BLE_MESH_PB_GATT)) #define PROV_BUF_HEADROOM 5 #else diff --git a/nimble/host/mesh/src/proxy.c b/nimble/host/mesh/src/proxy.c index 134a36dd6..96f6357d3 100644 --- a/nimble/host/mesh/src/proxy.c +++ b/nimble/host/mesh/src/proxy.c @@ -84,6 +84,14 @@ ble_uuid16_t BT_UUID_MESH_PROXY_DATA_OUT = BLE_UUID16_INIT(0x2ade); #define CLIENT_BUF_SIZE 68 +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + static const struct ble_gap_adv_params slow_adv_param = { .conn_mode = (BLE_GAP_CONN_MODE_UND), .disc_mode = (BLE_GAP_DISC_MODE_GEN), diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c index caf1b4f12..363993bc2 100644 --- a/nimble/host/mesh/src/transport.c +++ b/nimble/host/mesh/src/transport.c @@ -62,6 +62,14 @@ BUILD_ASSERT(CONFIG_BT_MESH_ADV_BUF_COUNT >= (CONFIG_BT_MESH_TX_SEG_MAX + 3)); /* How long to wait for available buffers before giving up */ #define BUF_TIMEOUT K_NO_WAIT +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + static struct seg_tx { struct bt_mesh_subnet *sub; struct os_mbuf *seg[CONFIG_BT_MESH_TX_SEG_MAX]; diff --git a/nimble/host/src/ble_l2cap_coc.c b/nimble/host/src/ble_l2cap_coc.c index 41a831565..fbeac34a2 100644 --- a/nimble/host/src/ble_l2cap_coc.c +++ b/nimble/host/src/ble_l2cap_coc.c @@ -40,6 +40,14 @@ static os_membuf_t ble_l2cap_coc_srv_mem[ static struct os_mempool ble_l2cap_coc_srv_pool; +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + static void ble_l2cap_coc_dbg_assert_srv_not_inserted(struct ble_l2cap_coc_srv *srv) {