You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by "David-Mudrich (via GitHub)" <gi...@apache.org> on 2024/02/22 19:14:09 UTC

[I] Change Macro from min to MIN in lpn.c [mynewt-nimble]

David-Mudrich opened a new issue, #1709:
URL: https://github.com/apache/mynewt-nimble/issues/1709

   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()) {
   -		return min(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1));
   +		return MIN(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1));
    	}
    
    	if (lpn->poll_timeout < POLL_TIMEOUT_MAX(lpn)) {
    		lpn->poll_timeout *= 2;
   -		lpn->poll_timeout = min(lpn->poll_timeout,
   +		lpn->poll_timeout = MIN(lpn->poll_timeout,
    					POLL_TIMEOUT_MAX(lpn));
    	}
    
   @@ -1000,7 +1000,7 @@
    		}
    
    		/* Set initial poll timeout */
   -		lpn->poll_timeout = min(POLL_TIMEOUT_MAX(lpn),
   +		lpn->poll_timeout = MIN(POLL_TIMEOUT_MAX(lpn),
    					POLL_TIMEOUT_INIT);
    	}
   
   --->8---
   
   Best regards


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org