patch-src_include_threads_h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. fix for:
  2. | src/lib/log.c:37:31: error: 'fr_strerror_buffer' undeclared (first use in this function)
  3. found in https://github.com/Optware/Optware-ng/commit/6ece960830b3291bc4ad5780cdb49b0a377aab2e
  4. --- freeradius-server-3.0.21.orig/src/include/threads.h 2020-03-24 15:55:09.000000000 +0100
  5. +++ freeradius-server-3.0.21/src/include/threads.h 2021-02-16 03:54:58.449715370 +0100
  6. @@ -89,7 +89,7 @@ static _t __fr_thread_local_init_##_n(pt
  7. # define fr_thread_local_get(_n) _n
  8. #elif defined(HAVE_PTHREAD_H)
  9. # include <pthread.h>
  10. -# define fr_thread_local_setup(_t, _n) \
  11. +# define fr_thread_local_setup(_t, _n) static __thread _t _n;\
  12. static pthread_key_t __fr_thread_local_key_##_n;\
  13. static pthread_once_t __fr_thread_local_once_##_n = PTHREAD_ONCE_INIT;\
  14. static pthread_destructor_t __fr_thread_local_destructor_##_n = NULL;\
  15. @@ -100,17 +100,17 @@ static void __fr_thread_local_destroy_##
  16. static void __fr_thread_local_key_init_##_n(void)\
  17. {\
  18. (void) pthread_key_create(&__fr_thread_local_key_##_n, __fr_thread_local_destroy_##_n);\
  19. - (void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
  20. }\
  21. static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
  22. {\
  23. __fr_thread_local_destructor_##_n = func;\
  24. if (_n) return _n; \
  25. (void) pthread_once(&__fr_thread_local_once_##_n, __fr_thread_local_key_init_##_n);\
  26. + (void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
  27. return _n;\
  28. }
  29. # define fr_thread_local_init(_n, _f) __fr_thread_local_init_##_n(_f)
  30. -# define fr_thread_local_set(_n, _v) __fr_thread_local_set_##_n(_v)
  31. -# define fr_thread_local_get(_n) __fr_thread_local_get_##_n()
  32. +# define fr_thread_local_set(_n, _v) ((int)!((_n = _v) || 1))
  33. +# define fr_thread_local_get(_n) _n
  34. #endif
  35. #endif