nedmalloc: do assignments only after the declaration section
authorRené Scharfe <l.s.r@web.de>
Wed, 7 Aug 2019 13:08:51 +0000 (15:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Aug 2019 18:54:45 +0000 (11:54 -0700)
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>
compat/nedmalloc/malloc.c.h
index b833ff9225e73ae830cab6057b6137864a6937c8..88c131ca93ade1da93eeaf4e10f8acdebb68e39e 100644 (file)
@@ -1755,10 +1755,10 @@ static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) {
   assert(sl->l != 0);
   assert(sl->threadid == CURRENT_THREAD);
   if (--sl->c == 0) {
-    sl->threadid = 0;
     volatile unsigned int* lp = &sl->l;
     int prev = 0;
     int ret;
+    sl->threadid = 0;
     __asm__ __volatile__ ("lock; xchgl %0, %1"
                          : "=r" (ret)
                          : "m" (*(lp)), "0"(prev)