]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
lib: fix sparse shadowed variable warning
authorHarvey Harrison <harvey.harrison@gmail.com>
Tue, 6 Jan 2009 22:40:49 +0000 (14:40 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:11 +0000 (15:59 -0800)
pos is always set before being used, no need to declare a
second one inside the if() block.

lib/prio_heap.c:34:7: warning: symbol 'pos' shadows an earlier one
lib/prio_heap.c:30:6: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/prio_heap.c

index 471944a54e23ecb964397a76716ea60236c5fdf3..a7af6f85eca8a239c39aabdc46a91ba9f861af1b 100644 (file)
@@ -31,7 +31,7 @@ void *heap_insert(struct ptr_heap *heap, void *p)
 
        if (heap->size < heap->max) {
                /* Heap insertion */
-               int pos = heap->size++;
+               pos = heap->size++;
                while (pos > 0 && heap->gt(p, ptrs[(pos-1)/2])) {
                        ptrs[pos] = ptrs[(pos-1)/2];
                        pos = (pos-1)/2;