diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-11-09 00:45:14 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-11-09 00:46:08 +0300 |
commit | 49e0e6e6b47056a51a858a36b6607a474f72bad0 (patch) | |
tree | 05bf70eeaed717fbdf9de260b859becd1a887121 /win32_threads.c | |
parent | e3b2cf50da098bacaddcc4aab73e1ea454647cd7 (diff) | |
download | bdwgc-49e0e6e6b47056a51a858a36b6607a474f72bad0.tar.gz |
Reduce scope of local variables in GC_remove_all_threads_but_me
This eliminates 'the scope of the variable can be reduced' cppcheck
warning in GC_remove_all_threads_but_me.
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Move p, next, me local variables to an inner scope there they are used.
* win32_threads.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Move p, next local variables to an inner scope.
Diffstat (limited to 'win32_threads.c')
-rw-r--r-- | win32_threads.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/win32_threads.c b/win32_threads.c index a2a8203e..5e470a76 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1033,12 +1033,14 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, STATIC void GC_remove_all_threads_but_me(void) { int hv; - GC_thread p, next, me = NULL; + GC_thread me = NULL; DWORD thread_id; pthread_t pthread_id = pthread_self(); /* same as in parent */ GC_ASSERT(!GC_win32_dll_threads); for (hv = 0; hv < THREAD_TABLE_SZ; ++hv) { + GC_thread p, next; + for (p = GC_threads[hv]; 0 != p; p = next) { next = p -> tm.next; if (THREAD_EQUAL(p -> pthread_id, pthread_id) |