On Thu, Dec 04, 2003 at 08:06:04PM -0000, Jeff Trawick wrote:
...
> #if !defined(apr_atomic_add32) && !defined(APR_OVERRIDE_ATOMIC_ADD32)
> -void apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
> +apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
> {
> + apr_uint32_t old_value;
> +
> #if APR_HAS_THREADS
> apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
>
> if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
> + old_value = *mem;
> *mem += val;
> apr_thread_mutex_unlock(lock);
> }
apr_atomic.c: In function `apr_atomic_add32':
apr_atomic.c:205: warning: `old_value' might be used uninitialized in this
function
I'd fix it but I'm not sure how... abort()?
assert(apr_thread_mutex_lock(lock) == APR_SUCCESS) instead? return a
random value since everything has gone to pot anyway?