diff options
author | Patrick Porlan <patrick.porlan@linux.intel.com> | 2011-03-16 10:24:23 +0100 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-03-16 21:34:54 -0500 |
commit | 2f0485e757d46206335d0181ae9d9705b29898d7 (patch) | |
tree | 32d7939693bd0971b4ab754762537c504842cb8c /gatchat | |
parent | 7617680d0d9bbd66f936b3f1eae6af8c56616cab (diff) | |
download | ofono-2f0485e757d46206335d0181ae9d9705b29898d7.tar.bz2 |
ringbuffer: Switch ringbuffer to g_slice allocator
This should allow for more efficient handling of equally sized
buffers, in terms of alignment and recycling.
Diffstat (limited to 'gatchat')
-rw-r--r-- | gatchat/ringbuffer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gatchat/ringbuffer.c b/gatchat/ringbuffer.c index 27be3a82..775498cf 100644 --- a/gatchat/ringbuffer.c +++ b/gatchat/ringbuffer.c @@ -51,11 +51,11 @@ struct ring_buffer *ring_buffer_new(unsigned int size) if (real_size > MAX_SIZE) return NULL; - buffer = g_try_new(struct ring_buffer, 1); + buffer = g_slice_new(struct ring_buffer); if (buffer == NULL) return NULL; - buffer->buffer = g_try_new(unsigned char, real_size); + buffer->buffer = g_slice_alloc(real_size); if (buffer->buffer == NULL) { g_free(buffer); return NULL; @@ -202,6 +202,6 @@ void ring_buffer_free(struct ring_buffer *buf) if (buf == NULL) return; - g_free(buf->buffer); - g_free(buf); + g_slice_free1(buf->size, buf->buffer); + g_slice_free1(sizeof(struct ring_buffer), buf); } |