summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-10-01 22:09:32 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-10-01 22:09:32 +0300
commitc743a6836cc35565f8ae474c7cda65df8321527a (patch)
treec384b04425e42331f4462d2a6d4140843f0a66a1 /win32_threads.c
parentee1c4b02b6a6ac8bd2384b90e929a5215c3e9f6e (diff)
downloadbdwgc-c743a6836cc35565f8ae474c7cda65df8321527a.tar.gz
Fix 'scope of hv can be reduced' cppcheck warning in GC_lookup_pthread
(fix of commit 48a01ee1c) * win32_threads.c [GC_PTHREADS] (GC_lookup_pthread): Move hv local variable definition to the inner block where it is used.
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/win32_threads.c b/win32_threads.c
index 8dbe6921..a3cf0893 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -1077,7 +1077,6 @@ GC_API void * GC_CALL GC_get_my_stackbottom(struct GC_stack_base *sb)
/* We first try the cache. If that fails, we use a very slow */
/* approach. */
int hv_guess = THREAD_TABLE_INDEX(GET_PTHREAD_MAP_CACHE(id));
- int hv;
GC_thread p;
DCL_LOCK_STATE;
@@ -1088,6 +1087,8 @@ GC_API void * GC_CALL GC_get_my_stackbottom(struct GC_stack_base *sb)
}
if (EXPECT(NULL == p, FALSE)) {
+ int hv;
+
for (hv = 0; hv < THREAD_TABLE_SZ; ++hv) {
for (p = GC_threads[hv]; p != NULL; p = p -> tm.next) {
if (THREAD_EQUAL(p -> pthread_id, id))