apache / mynewt-nimble

Apache mynewt
https://mynewt.apache.org/
Apache License 2.0
665 stars 385 forks source link

Change Macro from min to MIN in lpn.c #1709

Open David-Mudrich opened 4 months ago

David-Mudrich commented 4 months ago

Hi, I am using Nimble in ESP-IDF from a C project and GCC complains about undefined function min() (small letters). MIN() (big letters) is used also in this file and works with C projects as it is defined in indirectly included mesh/glue.h (via mesh/mesh.h). Please change other occurrences from min to MIN.

---8<---

--- lpn_orig.c 2024-02-14 21:01:16.662505000 +0100 +++ lpn.c 2024-02-22 20:05:41.852456394 +0100 @@ -32,7 +32,7 @@

endif

define LPN_RECV_DELAY MYNEWT_VAL(BLE_MESH_LPN_RECV_DELAY)

-#define SCAN_LATENCY min(MYNEWT_VAL(BLE_MESH_LPN_SCAN_LATENCY), \ +#define SCAN_LATENCY MIN(MYNEWT_VAL(BLE_MESH_LPN_SCAN_LATENCY), \ LPN_RECV_DELAY)

define FRIEND_REQ_RETRY_TIMEOUT K_SECONDS(MYNEWT_VAL(BLE_MESH_LPN_RETRY_TIMEOUT))

@@ -152,12 +152,12 @@ { / If we're waiting for segment acks keep polling at high freq / if (bt_mesh_tx_in_progress()) {

@@ -1000,7 +1000,7 @@ }

    /* Set initial poll timeout */

--->8---

Best regards