You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/08/11 21:27:26 UTC

[26/50] [abbrv] incubator-mynewt-core git commit: BLE Host - Use os_mbuf_append_from, not handrolled

BLE Host - Use os_mbuf_append_from, not handrolled

This commit does not change any behavior.  Some code was re-inventing
os_mbuf_append_from().  Now it just calls the function.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/5f3def81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5f3def81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5f3def81

Branch: refs/heads/phyrx_no_mbuf
Commit: 5f3def8132dc3b7dff8c09dd42fd328637cc68fe
Parents: b3610c4
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Aug 5 12:15:11 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Thu Aug 11 14:26:25 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_att_svr.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5f3def81/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c
index 7ccae06..2e1f158 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -617,7 +617,7 @@ ble_att_svr_tx_rsp(uint16_t conn_handle, int rc, struct os_mbuf *om,
         ble_hs_unlock();
     }
 
-    /* Free mbuf if it was not consumed (send failed). */
+    /* Free mbuf if it was not consumed (i.e., if the send failed). */
     os_mbuf_free_chain(om);
 
     return rc;
@@ -2367,7 +2367,6 @@ ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
     struct ble_att_prep_entry *prep_prev;
     struct ble_att_svr_entry *attr_entry;
     struct ble_hs_conn *conn;
-    struct os_mbuf *srcom;
     struct os_mbuf *txom;
     uint16_t err_handle;
     uint8_t *buf;
@@ -2428,16 +2427,10 @@ ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom)
         }
 
         /* Append attribute value from request onto prep mbuf. */
-        for (srcom = *rxom;
-             srcom != NULL;
-             srcom = SLIST_NEXT(srcom, om_next)) {
-
-            rc = os_mbuf_append(prep_entry->bape_value, srcom->om_data,
-                                srcom->om_len);
-            if (rc != 0) {
-                att_err = BLE_ATT_ERR_PREPARE_QUEUE_FULL;
-                break;
-            }
+        rc = os_mbuf_appendfrom(prep_entry->bape_value, *rxom, 0,
+                                OS_MBUF_PKTLEN(*rxom));
+        if (rc != 0) {
+            att_err = BLE_ATT_ERR_PREPARE_QUEUE_FULL;
         }
     }