mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
gst/gstregistrybinary.c: Align memory to the pointer size even if the architecture allows unaligned memory access. Un...
Original commit message from CVS: * gst/gstregistrybinary.c: (gst_registry_binary_write): Align memory to the pointer size even if the architecture allows unaligned memory access. Unaligned memory access usually comes with performance penality.
This commit is contained in:
parent
79bd94558c
commit
6c85176725
2 changed files with 10 additions and 11 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-03-23 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* gst/gstregistrybinary.c: (gst_registry_binary_write):
|
||||
Align memory to the pointer size even if the architecture allows
|
||||
unaligned memory access. Unaligned memory access usually comes with
|
||||
performance penality.
|
||||
|
||||
2008-03-23 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* gst/gstregistrybinary.c: (gst_registry_binary_write),
|
||||
|
|
|
@ -88,15 +88,9 @@
|
|||
_outptr = g_strdup ((gchar *)_inptr); \
|
||||
_inptr += strlen(_outptr) + 1
|
||||
|
||||
#if !GST_HAVE_UNALIGNED_ACCESS
|
||||
#define ALIGNMENT (sizeof (void *))
|
||||
#define alignment(_address) (gsize)_address%ALIGNMENT
|
||||
#define align(_ptr) _ptr += (( alignment(_ptr) == 0) ? 0 : ALIGNMENT-alignment(_ptr))
|
||||
#else
|
||||
# define ALIGNMENT 0
|
||||
# define alignment(_address) 0
|
||||
# define align(_ptr) do {} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
/* Registry saving */
|
||||
|
@ -112,7 +106,6 @@ inline static gboolean
|
|||
gst_registry_binary_write (GstRegistry * registry, const void *mem,
|
||||
const gssize size, unsigned long *file_position, gboolean align)
|
||||
{
|
||||
#if !GST_HAVE_UNALIGNED_ACCESS
|
||||
gchar padder[ALIGN] = { 0, };
|
||||
int padsize = 0;
|
||||
|
||||
|
@ -125,7 +118,6 @@ gst_registry_binary_write (GstRegistry * registry, const void *mem,
|
|||
}
|
||||
*file_position = *file_position + padsize;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (write (registry->cache_file, mem, size) != size) {
|
||||
GST_ERROR ("Failed to write binary registry element");
|
||||
|
|
Loading…
Reference in a new issue