nedmalloc: do assignments only after the declaration section
Avoid the following compiler warning: In file included from compat/nedmalloc/nedmalloc.c:63: compat/nedmalloc/malloc.c.h: In function ‘pthread_release_lock’: compat/nedmalloc/malloc.c.h:1759:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 1759 | volatile unsigned int* lp = &sl->l; | ^~~~~~~~ Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Aug 7, 2019 at 15:08 UTC
c9b9c09dae175f75bed4363cc6278c3f0cb3b9dd
1 file changed
+1
-1
compat/nedmalloc/malloc.c.h
+1
-1
@@ -1755,10 +1755,10 @@ static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) {
1755
assert(sl->l != 0);
1756
assert(sl->threadid == CURRENT_THREAD);
1757
if (--sl->c == 0) {
1758
- sl->threadid = 0;
1758
volatile unsigned int* lp = &sl->l;
1759
int prev = 0;
1760
int ret;
1761
+ sl->threadid = 0;
1762
__asm__ __volatile__ ("lock; xchgl %0, %1"
1763
: "=r" (ret)
1764
: "m" (*(lp)), "0"(prev)