]> granicus.if.org Git - libatomic_ops/commitdiff
Eliminate 'scope of variable can be reduced' cppcheck warning in AO_stack
authorIvan Maidanski <ivmai@mail.ru>
Tue, 11 Oct 2016 07:01:35 +0000 (10:01 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 11 Oct 2016 07:01:35 +0000 (10:01 +0300)
* src/atomic_ops_stack.c [AO_HAVE_compare_and_swap_double]
(AO_stack_push_release): Move local variable declaration to the inner
scope where the variable is actually used.

src/atomic_ops_stack.c

index ad12f0606210d6d40979d70cda84a23ce8ede362..6bd7cf0fc044c56dd4d393f8f6a7f0c8d3a3e9de 100644 (file)
@@ -250,9 +250,10 @@ AO_t *AO_stack_pop_acquire(AO_stack_t *list)
 void AO_stack_push_release(AO_stack_t *list, AO_t *element)
 {
     AO_t version;
-    AO_t next_ptr;
 
     do {
+      AO_t next_ptr;
+
       /* Again version must be loaded first, for different reason.      */
       version = AO_load_acquire(&(list -> version));
       next_ptr = AO_load(&(list -> ptr));