From: David Schleef Date: Tue, 21 Jan 2003 20:50:27 +0000 (+0000) Subject: Replace __alignof__() GCC-ism with sizeof(). Should produce exactly the same code... X-Git-Tag: BRANCH-RELEASE-0_5_2-ROOT~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb9d8102637026ea2b7d0fc14f445b957f43ca70;p=platform%2Fupstream%2Fgstreamer.git Replace __alignof__() GCC-ism with sizeof(). Should produce exactly the same code on all architectures except perhap... Original commit message from CVS: Replace __alignof__() GCC-ism with sizeof(). Should produce exactly the same code on all architectures except perhaps m68k. --- diff --git a/gst/elements/gstmd5sink.c b/gst/elements/gstmd5sink.c index ef9f462..d7d66ad 100644 --- a/gst/elements/gstmd5sink.c +++ b/gst/elements/gstmd5sink.c @@ -151,7 +151,13 @@ md5_process_bytes (const void *buffer, size_t len, GstMD5Sink *ctx) size_t add = 128 - left_over > len ? len : 128 - left_over; /* Only put full words in the buffer. */ - add -= add % __alignof__ (guint32); + /* Forcing alignment here appears to be only an optimization. + * The glibc source uses __alignof__, which seems to be a + * gratuitous usage of a GCC extension, when sizeof() will + * work fine. (And don't question the sanity of using + * sizeof(guint32) instead of 4. */ + /* add -= add % __alignof__ (guint32); */ + add -= add % sizeof(guint32); memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; diff --git a/plugins/elements/gstmd5sink.c b/plugins/elements/gstmd5sink.c index ef9f462..d7d66ad 100644 --- a/plugins/elements/gstmd5sink.c +++ b/plugins/elements/gstmd5sink.c @@ -151,7 +151,13 @@ md5_process_bytes (const void *buffer, size_t len, GstMD5Sink *ctx) size_t add = 128 - left_over > len ? len : 128 - left_over; /* Only put full words in the buffer. */ - add -= add % __alignof__ (guint32); + /* Forcing alignment here appears to be only an optimization. + * The glibc source uses __alignof__, which seems to be a + * gratuitous usage of a GCC extension, when sizeof() will + * work fine. (And don't question the sanity of using + * sizeof(guint32) instead of 4. */ + /* add -= add % __alignof__ (guint32); */ + add -= add % sizeof(guint32); memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add;