wrowe 2003/11/16 12:09:45
Modified: include apr_atomic.h
Log:
Correct misdeclaration of Win32 type remapping function typedefs.
Be pedantic in protecting some macro arguments, fix odd typos,
and use InterlockedExchangeAdd(*foo, -bar) for subtraction.
Revision Changes Path
1.64 +6 -6 apr/include/apr_atomic.h
Index: apr_atomic.h
===================================================================
RCS file: /home/cvs/apr/include/apr_atomic.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- apr_atomic.h 16 Nov 2003 01:33:02 -0000 1.63
+++ apr_atomic.h 16 Nov 2003 20:09:45 -0000 1.64
@@ -193,28 +193,28 @@
* Remapping function pointer type to accept apr_uint32_t's type-safely
* as the arguments for as our apr_atomic_foo32 Functions
*/
-typedef WINBASEAPI apr_uint32_t (WINAPI apr_atomic_win32_ptr_fn)
+typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_fn)
(apr_uint32_t volatile *);
-typedef WINBASEAPI apr_uint32_t (WINAPI apr_atomic_win32_ptr_val_fn)
+typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn)
(apr_uint32_t volatile *,
apr_uint32_t);
-typedef WINBASEAPI apr_uint32_t (WINAPI apr_atomic_win32_ptr_val_val_fn)
+typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn)
(apr_uint32_t volatile *,
apr_uint32_t, apr_uint32_t);
#define apr_atomic_add32(mem, val) \
((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem,val)
#define apr_atomic_sub32(mem, val) \
- ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeSub)(mem,val)
+ ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem,-(val))
#define apr_atomic_inc32(mem) \
((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem)
#define apr_atomic_dec32(mem) \
((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem)
#define apr_atomic_set32(mem, val) \
((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem,val)
-#define apr_atomic_read32(mem) (*mem)
+#define apr_atomic_read32(mem) (*(mem))
#define apr_atomic_cas32(mem,with,cmp) \
- ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem,val)
+
((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem,with,cmp)
#define apr_atomic_xchg32(mem,val) \
((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem,val)