Skip to content

Commit c9b9c09

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aeb582a commit c9b9c09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/nedmalloc/malloc.c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,10 +1755,10 @@ static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) {
17551755
assert(sl->l != 0);
17561756
assert(sl->threadid == CURRENT_THREAD);
17571757
if (--sl->c == 0) {
1758-
sl->threadid = 0;
17591758
volatile unsigned int* lp = &sl->l;
17601759
int prev = 0;
17611760
int ret;
1761+
sl->threadid = 0;
17621762
__asm__ __volatile__ ("lock; xchgl %0, %1"
17631763
: "=r" (ret)
17641764
: "m" (*(lp)), "0"(prev)

0 commit comments

Comments
 (0)