Avoid self assignment in tsd_set().
This commit is contained in:
parent
0222fb41d1
commit
61f467e16a
@ -226,7 +226,8 @@ a_name##tsd_set(a_type *val) \
|
|||||||
{ \
|
{ \
|
||||||
\
|
\
|
||||||
assert(a_name##tsd_booted); \
|
assert(a_name##tsd_booted); \
|
||||||
a_name##tsd_tls = (*val); \
|
if (likely(&a_name##tsd_tls != val)) \
|
||||||
|
a_name##tsd_tls = (*val); \
|
||||||
if (a_cleanup != malloc_tsd_no_cleanup) \
|
if (a_cleanup != malloc_tsd_no_cleanup) \
|
||||||
a_name##tsd_initialized = true; \
|
a_name##tsd_initialized = true; \
|
||||||
}
|
}
|
||||||
@ -277,7 +278,8 @@ a_name##tsd_set(a_type *val) \
|
|||||||
{ \
|
{ \
|
||||||
\
|
\
|
||||||
assert(a_name##tsd_booted); \
|
assert(a_name##tsd_booted); \
|
||||||
a_name##tsd_tls = (*val); \
|
if (likely(&a_name##tsd_tls != val)) \
|
||||||
|
a_name##tsd_tls = (*val); \
|
||||||
if (a_cleanup != malloc_tsd_no_cleanup) { \
|
if (a_cleanup != malloc_tsd_no_cleanup) { \
|
||||||
if (pthread_setspecific(a_name##tsd_tsd, \
|
if (pthread_setspecific(a_name##tsd_tsd, \
|
||||||
(void *)(&a_name##tsd_tls))) { \
|
(void *)(&a_name##tsd_tls))) { \
|
||||||
@ -409,7 +411,8 @@ a_name##tsd_set(a_type *val) \
|
|||||||
\
|
\
|
||||||
assert(a_name##tsd_booted); \
|
assert(a_name##tsd_booted); \
|
||||||
wrapper = a_name##tsd_wrapper_get(); \
|
wrapper = a_name##tsd_wrapper_get(); \
|
||||||
wrapper->val = *(val); \
|
if (likely(&wrapper->val != val)) \
|
||||||
|
wrapper->val = *(val); \
|
||||||
if (a_cleanup != malloc_tsd_no_cleanup) \
|
if (a_cleanup != malloc_tsd_no_cleanup) \
|
||||||
wrapper->initialized = true; \
|
wrapper->initialized = true; \
|
||||||
}
|
}
|
||||||
@ -537,7 +540,8 @@ a_name##tsd_set(a_type *val) \
|
|||||||
\
|
\
|
||||||
assert(a_name##tsd_booted); \
|
assert(a_name##tsd_booted); \
|
||||||
wrapper = a_name##tsd_wrapper_get(); \
|
wrapper = a_name##tsd_wrapper_get(); \
|
||||||
wrapper->val = *(val); \
|
if (likely(&wrapper->val != val)) \
|
||||||
|
wrapper->val = *(val); \
|
||||||
if (a_cleanup != malloc_tsd_no_cleanup) \
|
if (a_cleanup != malloc_tsd_no_cleanup) \
|
||||||
wrapper->initialized = true; \
|
wrapper->initialized = true; \
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user