You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2020/03/07 00:09:34 UTC

[mynewt-nimble] 03/11: nimble/l2cap: Redo defines to static inline

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

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

commit 050c2b65987d9a2529e4a127044ea685d2197f8a
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Mon Feb 10 14:16:48 2020 +0100

    nimble/l2cap: Redo defines to static inline
---
 nimble/host/src/ble_l2cap_coc_priv.h | 30 +++++++++++++++++++++++++-----
 nimble/host/src/ble_l2cap_sig_priv.h | 16 +++++++++++++---
 2 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/nimble/host/src/ble_l2cap_coc_priv.h b/nimble/host/src/ble_l2cap_coc_priv.h
index 67e523d..f8d4850 100644
--- a/nimble/host/src/ble_l2cap_coc_priv.h
+++ b/nimble/host/src/ble_l2cap_coc_priv.h
@@ -71,11 +71,31 @@ int ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan,
                              struct os_mbuf *sdu_rx);
 int ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx);
 #else
-#define ble_l2cap_coc_init()                                    0
-#define ble_l2cap_coc_create_server(psm, mtu, cb, cb_arg)       BLE_HS_ENOTSUP
-#define ble_l2cap_coc_recv_ready(chan, sdu_rx)                  BLE_HS_ENOTSUP
-#define ble_l2cap_coc_cleanup_chan(conn, chan)
-#define ble_l2cap_coc_send(chan, sdu_tx)                        BLE_HS_ENOTSUP
+static inline int
+ble_l2cap_coc_init(void) {
+    return 0;
+}
+
+static inline int
+ble_l2cap_coc_create_server(uint16_t psm, uint16_t mtu,
+                            ble_l2cap_event_fn *cb, void *cb_arg) {
+    return BLE_HS_ENOTSUP;
+}
+
+static inline int
+ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan,
+                         struct os_mbuf *sdu_rx) {
+    return BLE_HS_ENOTSUP;
+}
+
+static inline void
+ble_l2cap_coc_cleanup_chan(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan) {
+}
+
+static inline int
+ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx) {
+    return BLE_HS_ENOTSUP;
+}
 #endif
 
 #ifdef __cplusplus
diff --git a/nimble/host/src/ble_l2cap_sig_priv.h b/nimble/host/src/ble_l2cap_sig_priv.h
index 1a6fb82..462a9e4 100644
--- a/nimble/host/src/ble_l2cap_sig_priv.h
+++ b/nimble/host/src/ble_l2cap_sig_priv.h
@@ -107,9 +107,19 @@ int ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan);
 int ble_l2cap_sig_le_credits(uint16_t conn_handle, uint16_t scid,
                              uint16_t credits);
 #else
-#define ble_l2cap_sig_coc_connect(conn_handle, psm, mtu, sdu_rx, cb, cb_arg) \
-                                                                BLE_HS_ENOTSUP
-#define ble_l2cap_sig_disconnect(chan)                          BLE_HS_ENOTSUP
+static inline int
+ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
+                          struct os_mbuf *sdu_rx,
+                          ble_l2cap_event_fn *cb, void *cb_arg)
+{
+    return BLE_HS_ENOTSUP;
+}
+
+static inline int
+ble_l2cap_sig_disconnect(struct ble_l2cap_chan *chan)
+{
+    return BLE_HS_ENOTSUP;
+}
 #endif
 
 void ble_l2cap_sig_conn_broken(uint16_t conn_handle, int reason);