1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

native_tls_get()' should not check results

caller should check the result of `native_tls_get()`.
This commit is contained in:
Koichi Sasada 2022-05-24 04:54:26 +09:00
parent 9c9c217045
commit 741ac50330
Notes: git 2022-05-24 10:07:24 +09:00
2 changed files with 4 additions and 10 deletions

View file

@ -102,11 +102,8 @@ typedef pthread_key_t native_tls_key_t;
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

View file

@ -44,11 +44,8 @@ typedef DWORD native_tls_key_t; // TLS index
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