Skip to content

Commit

Permalink
Consistently declare min() macro before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn authored and sjanc committed Jan 13, 2025
1 parent 39b367f commit cf947cd
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/blemesh/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "services/gap/ble_svc_gap.h"
#include "mesh/glue.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

/* Company ID */
#define CID_VENDOR 0x05C3
#define STANDARD_TEST_ID 0x00
Expand Down
4 changes: 4 additions & 0 deletions apps/blestress/src/rx_stress.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include <host/ble_gap.h>
#include "rx_stress.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

/* UUID128 of stress test use cases*/
static uint8_t rx_stress_uuid128[STRESS_UUIDS_NUM][16];

Expand Down
4 changes: 4 additions & 0 deletions apps/btshell/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
#include "cmd_l2cap.h"
#include "cmd_leaudio.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#define BTSHELL_MODULE "btshell"

int
Expand Down
4 changes: 4 additions & 0 deletions apps/btshell/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
#include "../src/ble_hs_atomic_priv.h"
#include "../src/ble_hs_priv.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#if MYNEWT_VAL(BLE_ROLE_CENTRAL)
#define BTSHELL_MAX_SVCS 32
#define BTSHELL_MAX_CHRS 64
Expand Down
4 changes: 4 additions & 0 deletions apps/bttester/src/btp_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

#include "btp/btp.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

extern uint8_t own_addr_type;

#define CONTROLLER_INDEX 0
Expand Down
4 changes: 4 additions & 0 deletions apps/bttester/src/bttester.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "bttester_pipe.h"
#include "btp/btp.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#define CMD_QUEUED 2

static struct os_eventq avail_queue;
Expand Down
4 changes: 4 additions & 0 deletions apps/bttester/src/rtt_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "syscfg/syscfg.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#if MYNEWT_VAL(BTTESTER_PIPE_RTT)

#include "os/mynewt.h"
Expand Down
4 changes: 4 additions & 0 deletions apps/mesh_badge/src/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "mesh.h"
#include "board.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#define BT_COMP_ID_LF 0x05f1

#define MOD_LF 0x0000
Expand Down
4 changes: 4 additions & 0 deletions apps/mesh_badge/src/reel_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#define printk console_printf

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

enum font_size {
FONT_BIG = 0,
FONT_MEDIUM = 1,
Expand Down
4 changes: 4 additions & 0 deletions nimble/controller/src/ble_ll_isoal.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include <controller/ble_ll_isoal.h>
#include <controller/ble_ll_iso_big.h>

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#if MYNEWT_VAL(BLE_LL_ISO)

STAILQ_HEAD(ble_ll_iso_tx_q, os_mbuf_pkthdr);
Expand Down
4 changes: 4 additions & 0 deletions nimble/drivers/dialog_cmac/src/ble_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#error LE Coded PHY cannot be enabled on DA1469x
#endif

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

/* Statistics */
STATS_SECT_START(ble_phy_stats)
STATS_SECT_ENTRY(phy_isrs)
Expand Down
4 changes: 4 additions & 0 deletions nimble/drivers/native/src/ble_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "controller/ble_phy.h"
#include "controller/ble_ll.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

/* BLE PHY data structure */
struct ble_phy_obj
{
Expand Down
4 changes: 4 additions & 0 deletions nimble/drivers/nrf51/src/ble_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
#error LE Coded PHY cannot be enabled on nRF51
#endif

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

static uint32_t
ble_phy_mode_pdu_start_off(int phy_mode)
{
Expand Down
4 changes: 4 additions & 0 deletions nimble/drivers/nrf5x/src/ble_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
#include <nrf_erratas.h>
#include "phy_priv.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_CODED_PHY)
#if !MYNEWT_VAL_CHOICE(MCU_TARGET, nRF52840) && \
!MYNEWT_VAL_CHOICE(MCU_TARGET, nRF52811) && \
Expand Down
4 changes: 4 additions & 0 deletions nimble/host/src/ble_iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
#include "ble_hs_hci_priv.h"
#include "ble_hs_mbuf_priv.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#define ble_iso_big_conn_handles_init(_big, _handles, _num_handles) \
do { \
struct ble_iso_conn *conn = SLIST_FIRST(&ble_iso_conns); \
Expand Down
4 changes: 4 additions & 0 deletions nimble/host/src/ble_l2cap_coc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "ble_l2cap_coc_priv.h"
#include "ble_l2cap_sig_priv.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM) != 0 && NIMBLE_BLE_CONNECT

#ifndef min
Expand Down
4 changes: 4 additions & 0 deletions nimble/host/test/src/ble_att_svr_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include "host/ble_l2cap.h"
#include "ble_hs_test_util.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

static uint8_t *ble_att_svr_test_attr_r_1;
static uint16_t ble_att_svr_test_attr_r_1_len;
static uint8_t *ble_att_svr_test_attr_r_2;
Expand Down
2 changes: 1 addition & 1 deletion porting/nimble/src/os_mbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1273,4 +1273,4 @@ os_mbuf_pack_chains(struct os_mbuf *m1, struct os_mbuf *m2)
}

return m1;
}
}

0 comments on commit cf947cd

Please sign in to comment.