gst/gstregistrybinary.c: Align memory to the pointer size even if the architecture...
authorSebastian Dröge <slomo@circular-chaos.org>
Sun, 23 Mar 2008 11:29:54 +0000 (11:29 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Sun, 23 Mar 2008 11:29:54 +0000 (11:29 +0000)
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.

ChangeLog
gst/gstregistrybinary.c

index 3215a3d..2672ac8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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),
        (gst_registry_binary_check_magic),
        (gst_registry_binary_load_pad_template),
index 9df5402..e3736c5 100644 (file)
   _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
+#define ALIGNMENT            (sizeof (void *))
+#define alignment(_address)  (gsize)_address%ALIGNMENT
+#define align(_ptr)          _ptr += (( alignment(_ptr) == 0) ? 0 : ALIGNMENT-alignment(_ptr))
 
 
 /* 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");