summaryrefslogtreecommitdiff
path: root/osi
diff options
context:
space:
mode:
authorPavlin Radoslavov <pavlin@google.com>2016-02-05 13:54:43 -0800
committerAndre Eisenbach <eisenbach@google.com>2016-02-18 10:37:26 -0800
commitabd70abb5e42c9431df94fe9d2c4a78a0d8d9af9 (patch)
tree5395f00ac27ab9ec5cc0d2d7b8dace61bcef6b5a /osi
parent9df3192b94a186207976ecc579d390f3cfd547c6 (diff)
downloadandroid-system-bt-abd70abb5e42c9431df94fe9d2c4a78a0d8d9af9.tar.gz
android-system-bt-abd70abb5e42c9431df94fe9d2c4a78a0d8d9af9.tar.xz
Replaced osi_getbuf()/osi_freebuf() with osi_malloc()/osi_free()
Removed the alternative buffer allocation osi_getbuf() / osi_freebuf() and use instead osi_malloc() / osi_free(). Correspondingly, replaced usage of osi_freebuf_and_reset() with osi_free_and_reset(). Bug: 24914560 Change-Id: I7a9599ba7fa900321f087da684428133eb0ddd6b
Diffstat (limited to 'osi')
-rw-r--r--osi/include/allocator.h19
-rw-r--r--osi/src/allocator.c35
2 files changed, 0 insertions, 54 deletions
diff --git a/osi/include/allocator.h b/osi/include/allocator.h
index 43909e0..e746883 100644
--- a/osi/include/allocator.h
+++ b/osi/include/allocator.h
@@ -46,22 +46,3 @@ void osi_free(void *ptr);
// |p_ptr| is a pointer to the buffer pointer to be reset.
// |p_ptr| cannot be NULL.
void osi_free_and_reset(void **p_ptr);
-
-//
-// TODO: The functions below should be removed and replaced with the
-// corresponding functions above.
-//
-
-// Allocate a buffer of size |size|. Return the allocated buffer if there
-// is enough memory, otherwise NULL.
-void *osi_getbuf(uint16_t size);
-
-// Free a buffer that was previously allocated with function |osi_getbuf|.
-// |ptr| can be NULL.
-void osi_freebuf(void *ptr);
-
-// Free a buffer that was previously allocated with function |osi_getbuf|
-// and reset the pointer to that buffer to NULL.
-// |p_ptr| is a pointer to the buffer pointer to be reset.
-// |p_ptr| cannot be NULL.
-void osi_freebuf_and_reset(void **p_ptr);
diff --git a/osi/src/allocator.c b/osi/src/allocator.c
index 662ae09..3d821a8 100644
--- a/osi/src/allocator.c
+++ b/osi/src/allocator.c
@@ -96,38 +96,3 @@ const allocator_t allocator_malloc = {
osi_malloc,
osi_free
};
-
-//
-// TODO: Temporary buffer-allocation wrappers: should be removed
-//
-#define MAGIC_NUMBER 0xDDBADDBA
-typedef struct _buffer_hdr
-{
- uint16_t size;
- uint32_t magic_number;
-} BUFFER_HDR_T;
-
-void *osi_getbuf(uint16_t size)
-{
- BUFFER_HDR_T *header = osi_malloc(size + sizeof(BUFFER_HDR_T));
- header->size = size;
- header->magic_number = MAGIC_NUMBER;
- return header + 1;
-}
-
-void osi_freebuf(void *p_buf)
-{
- if (p_buf == NULL)
- return;
-
- BUFFER_HDR_T *header = (BUFFER_HDR_T *)p_buf - 1;
- assert(header->magic_number == MAGIC_NUMBER);
- osi_free(header);
-}
-
-void osi_freebuf_and_reset(void **p_ptr)
-{
- assert(p_ptr != NULL);
- osi_freebuf(*p_ptr);
- *p_ptr = NULL;
-}