Make sizeof(GstBuffer) independent of config.h and HAVE_ATOMIC_H. This still needs a more fundamental solution though.

Original commit message from CVS:
Make sizeof(GstBuffer) independent of config.h and HAVE_ATOMIC_H. This still
needs a more fundamental solution though.
This commit is contained in:
Wim Taymans 2002-07-13 23:08:04 +00:00
parent 713d471ddd
commit b43cf3886a

View file

@ -37,7 +37,13 @@ typedef struct _GstAtomicInt GstAtomicInt;
struct _GstAtomicInt {
#ifdef HAVE_ATOMIC_H
atomic_t value;
union {
atomic_t value;
struct {
int value;
GMutex *lock;
} unused;
} v;
#else
int value;
GMutex *lock;
@ -47,15 +53,15 @@ struct _GstAtomicInt {
#ifdef HAVE_ATOMIC_H
/* atomic functions */
#define GST_ATOMIC_INT_INIT(ref, val) (atomic_set(&((ref)->value), (val)))
#define GST_ATOMIC_INT_INIT(ref, val) (atomic_set(&((ref)->v.value), (val)))
#define GST_ATOMIC_INT_FREE(ref)
#define GST_ATOMIC_INT_SET(ref,val) (atomic_set(&((ref)->value), (val)))
#define GST_ATOMIC_INT_VALUE(ref) (atomic_read(&((ref)->value)))
#define GST_ATOMIC_INT_READ(ref,res) (*res = atomic_read(&((ref)->value)))
#define GST_ATOMIC_INT_INC(ref) (atomic_inc (&((ref)->value)))
#define GST_ATOMIC_INT_DEC_AND_TEST(ref,zero) (*zero = atomic_dec_and_test (&((ref)->value)))
#define GST_ATOMIC_INT_ADD(ref, count) (atomic_add ((count), &((ref)->value)))
#define GST_ATOMIC_INT_SET(ref,val) (atomic_set(&((ref)->v.value), (val)))
#define GST_ATOMIC_INT_VALUE(ref) (atomic_read(&((ref)->v.value)))
#define GST_ATOMIC_INT_READ(ref,res) (*res = atomic_read(&((ref)->v.value)))
#define GST_ATOMIC_INT_INC(ref) (atomic_inc (&((ref)->v.value)))
#define GST_ATOMIC_INT_DEC_AND_TEST(ref,zero) (*zero = atomic_dec_and_test (&((ref)->v.value)))
#define GST_ATOMIC_INT_ADD(ref, count) (atomic_add ((count), &((ref)->v.value)))
#else
@ -152,8 +158,6 @@ G_STMT_START { \
" movl %%edx, %%ecx;" \
" incl %%ecx;" \
GST_ATOMIC_LOCK "cmpxchg8b %1;" \
" jz 20f;" \
" testl %%eax, %%eax;" \
" jnz 10b;" \
"20:\t" \
: "=a" (*res) \