memmory: small cleanup

This commit is contained in:
Wim Taymans 2011-06-02 18:28:17 +02:00
parent c8fc05743d
commit b05ee3ddb2

View file

@ -121,8 +121,10 @@ _default_mem_new_block (gsize maxsize, gsize align, gsize offset, gsize size)
gsize aoffset, slice_size; gsize aoffset, slice_size;
guint8 *data; guint8 *data;
/* allocate more to compensate for alignment */
maxsize += align;
/* alloc header and data in one block */ /* alloc header and data in one block */
slice_size = sizeof (GstMemoryDefault) + maxsize + align; slice_size = sizeof (GstMemoryDefault) + maxsize;
mem = g_slice_alloc (slice_size); mem = g_slice_alloc (slice_size);
if (mem == NULL) if (mem == NULL)
@ -133,7 +135,7 @@ _default_mem_new_block (gsize maxsize, gsize align, gsize offset, gsize size)
if ((aoffset = ((guintptr) data & align))) if ((aoffset = ((guintptr) data & align)))
aoffset = (align + 1) - aoffset; aoffset = (align + 1) - aoffset;
_default_mem_init (mem, 0, NULL, slice_size, data, NULL, maxsize + align, _default_mem_init (mem, 0, NULL, slice_size, data, NULL, maxsize,
aoffset + offset, size); aoffset + offset, size);
return mem; return mem;