oic; remove oc_message, and it's memory pool.
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/826fd665 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/826fd665 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/826fd665 Branch: refs/heads/develop Commit: 826fd665f2517152f6931e03435a9e9c8df58299 Parents: 72c5dce Author: Marko Kiiskila <[email protected]> Authored: Fri Jan 6 13:21:59 2017 -0800 Committer: Marko Kiiskila <[email protected]> Committed: Fri Jan 6 15:03:01 2017 -0800 ---------------------------------------------------------------------- net/oic/src/api/oc_buffer.c | 44 --------------------------------- net/oic/src/api/oc_buffer.h | 5 ---- net/oic/src/port/mynewt/adaptor.h | 2 -- net/oic/src/port/oc_connectivity.h | 7 ------ 4 files changed, 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/826fd665/net/oic/src/api/oc_buffer.c ---------------------------------------------------------------------- diff --git a/net/oic/src/api/oc_buffer.c b/net/oic/src/api/oc_buffer.c index 15e1587..9857eaf 100644 --- a/net/oic/src/api/oc_buffer.c +++ b/net/oic/src/api/oc_buffer.c @@ -32,29 +32,9 @@ #include "port/mynewt/adaptor.h" -static struct os_mempool oc_buffers; -static uint8_t oc_buffer_area[OS_MEMPOOL_BYTES(1, sizeof(oc_message_t))]; - static struct os_mqueue oc_inq; static struct os_mqueue oc_outq; -oc_message_t * -oc_allocate_message(void) -{ - oc_message_t *message = (oc_message_t *)os_memblock_get(&oc_buffers); - - if (message) { - message->length = 0; - message->ref_count = 1; - OC_LOG_DEBUG("buffer: Allocated oc_message; free: %d\n", - oc_buffers.mp_num_free); - } else { - OC_LOG_ERROR("buffer: No free oc_mesages!\n"); - assert(0); - } - return message; -} - struct os_mbuf * oc_allocate_mbuf(struct oc_endpoint *oe) { @@ -70,28 +50,6 @@ oc_allocate_mbuf(struct oc_endpoint *oe) } void -oc_message_add_ref(oc_message_t *message) -{ - if (message) { - message->ref_count++; - } -} - -void -oc_message_unref(oc_message_t *message) -{ - if (message) { - assert(message->ref_count > 0); - message->ref_count--; - if (message->ref_count == 0) { - os_memblock_put(&oc_buffers, message); - OC_LOG_DEBUG("buffer: freed oc_message; free: %d\n", - oc_buffers.mp_num_free); - } - } -} - -void oc_recv_message(struct os_mbuf *m) { int rc; @@ -180,8 +138,6 @@ oc_buffer_rx(struct os_event *ev) void oc_buffer_init(void) { - os_mempool_init(&oc_buffers, 1, sizeof(oc_message_t), oc_buffer_area, - "oc_bufs"); os_mqueue_init(&oc_inq, oc_buffer_rx, NULL); os_mqueue_init(&oc_outq, oc_buffer_tx, NULL); } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/826fd665/net/oic/src/api/oc_buffer.h ---------------------------------------------------------------------- diff --git a/net/oic/src/api/oc_buffer.h b/net/oic/src/api/oc_buffer.h index bf72910..70825cf 100644 --- a/net/oic/src/api/oc_buffer.h +++ b/net/oic/src/api/oc_buffer.h @@ -21,15 +21,10 @@ extern "C" { #endif -struct oc_message; struct os_mbuf; struct oc_endpoint; -struct oc_message *oc_allocate_message(void); struct os_mbuf *oc_allocate_mbuf(struct oc_endpoint *oe); -void oc_message_add_ref(struct oc_message *message); -void oc_message_unref(struct oc_message *message); - void oc_recv_message(struct os_mbuf *m); void oc_send_message(struct os_mbuf *m); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/826fd665/net/oic/src/port/mynewt/adaptor.h ---------------------------------------------------------------------- diff --git a/net/oic/src/port/mynewt/adaptor.h b/net/oic/src/port/mynewt/adaptor.h index 025efd6..efa4e71 100644 --- a/net/oic/src/port/mynewt/adaptor.h +++ b/net/oic/src/port/mynewt/adaptor.h @@ -27,8 +27,6 @@ extern "C" { struct os_eventq *oc_evq_get(void); void oc_evq_set(struct os_eventq *evq); -struct oc_message; - #if (MYNEWT_VAL(OC_TRANSPORT_IP) == 1) int oc_connectivity_init_ip(void); void oc_connectivity_shutdown_ip(void); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/826fd665/net/oic/src/port/oc_connectivity.h ---------------------------------------------------------------------- diff --git a/net/oic/src/port/oc_connectivity.h b/net/oic/src/port/oc_connectivity.h index b86ec19..c4d205c 100644 --- a/net/oic/src/port/oc_connectivity.h +++ b/net/oic/src/port/oc_connectivity.h @@ -84,13 +84,6 @@ typedef struct oc_endpoint { .v6 = {.port = __port__, \ .address = { __VA_ARGS__ } } } } -typedef struct oc_message { - oc_endpoint_t endpoint; - size_t length; - uint8_t ref_count; - uint8_t data[MAX_PAYLOAD_SIZE]; -} oc_message_t; - #ifdef OC_SECURITY uint16_t oc_connectivity_get_dtls_port(void); #endif /* OC_SECURITY */
