ruby-changes:71936
From: Koichi <ko1@a...>
Date: Tue, 24 May 2022 10:07:23 +0900 (JST)
Subject: [ruby-changes:71936] 741ac50330 (master): `native_tls_get()`' should not check results
https://git.ruby-lang.org/ruby.git/commit/?id=741ac50330 From 741ac503309f32b5c39073f46a205c99a31d4b0e Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Tue, 24 May 2022 04:54:26 +0900 Subject: `native_tls_get()`' should not check results caller should check the result of `native_tls_get()`. --- thread_pthread.h | 7 ++----- thread_win32.h | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/thread_pthread.h b/thread_pthread.h index b5314082d5..3f6db3ed03 100644 --- a/thread_pthread.h +++ b/thread_pthread.h @@ -102,11 +102,8 @@ typedef pthread_key_t native_tls_key_t; https://github.com/ruby/ruby/blob/trunk/thread_pthread.h#L102 static inline void * native_tls_get(native_tls_key_t key) { - void *ptr = pthread_getspecific(key); - if (UNLIKELY(ptr == NULL)) { - rb_bug("pthread_getspecific returns NULL"); - } - return ptr; + // return value should be checked by caller + return pthread_getspecific(key); } static inline void diff --git a/thread_win32.h b/thread_win32.h index 12aef02728..f00f3b2056 100644 --- a/thread_win32.h +++ b/thread_win32.h @@ -44,11 +44,8 @@ typedef DWORD native_tls_key_t; // TLS index https://github.com/ruby/ruby/blob/trunk/thread_win32.h#L44 static inline void * native_tls_get(native_tls_key_t key) { - void *ptr = TlsGetValue(key); - if (UNLIKELY(ptr == NULL)) { - rb_bug("TlsGetValue() returns NULL"); - } - return ptr; + // return value should be checked by caller. + return TlsGetValue(key); } static inline void -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/