summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2017-10-23 17:28:27 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2017-10-23 17:28:27 +0000
commit3c414ecd5e861fd58f708d4418f6c50152c00f36 (patch)
tree60ae168c31be38cb49c7a8f3e94ea0b718f94a00 /lib
parent624023183d6dd419e6a7206db53f0ae916dd9281 (diff)
This file isn't built anymore. So remove diffs with upstreams.
Diffstat (limited to 'lib')
-rw-r--r--lib/libX11/src/UIThrStubs.c97
1 files changed, 6 insertions, 91 deletions
diff --git a/lib/libX11/src/UIThrStubs.c b/lib/libX11/src/UIThrStubs.c
index fd28a4868..95873e88f 100644
--- a/lib/libX11/src/UIThrStubs.c
+++ b/lib/libX11/src/UIThrStubs.c
@@ -47,13 +47,6 @@
* distinguishing each of the drafts.
*/
-#include <stdlib.h>
-
-static int _Xthr_once_stub_(void *, void (*)(void));
-static int _Xthr_key_create_stub_(unsigned int *, void (*)(void *));
-static int _Xthr_setspecific_stub_(unsigned int, const void *);
-static void *_Xthr_getspecific_stub_(unsigned int);
-
#ifdef CTHREADS
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -117,10 +110,9 @@ int pthread_cond_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
int pthread_cond_wait() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
int pthread_cond_signal() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
-int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_key_create_stub_")));
-void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_getspecific_stub_")));
-int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_setspecific_stub_")));
-int pthread_once() __attribute__ ((weak, alias ("_Xthr_once_stub_")));
+int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
+void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
+int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
#else /* __GNUC__ */
#pragma weak pthread_self = _Xthr_self_stub_
#pragma weak pthread_mutex_init = _Xthr_zero_stub_
@@ -133,10 +125,9 @@ int pthread_once() __attribute__ ((weak, alias ("_Xthr_once_stub_")));
#pragma weak pthread_cond_signal = _Xthr_zero_stub_
#pragma weak pthread_cond_broadcast = _Xthr_zero_stub_
/* These are added for libGL */
-#pragma weak pthread_key_create = _Xthr_key_create_stub_
-#pragma weak pthread_getspecific = _Xthr_getspecific_stub_
-#pragma weak pthread_setspecific = _Xthr_setspecific_stub_
-#pragam weak pthread_once = _Xthr_once_stub_
+#pragma weak pthread_key_create = _Xthr_zero_stub_
+#pragma weak pthread_getspecific = _Xthr_zero_stub_
+#pragma weak pthread_setspecific = _Xthr_zero_stub_
#endif /* __GNUC__ */
#if defined(_DECTHREADS_) || defined(linux)
#pragma weak pthread_equal = _Xthr_equal_stub_ /* See Xthreads.h! */
@@ -164,79 +155,3 @@ _Xthr_zero_stub_()
{
return(0);
}
-
-#include <errno.h>
-
-#define XTHR_ONCE_KEYS_CHUNK 100
-static void**_Xthr_once_keys_ = NULL;
-static unsigned int _Xthr_once_last_key_ = 0;
-
-static int
-_Xthr_once_stub_(void *id, void (*routine)(void))
-{
- void **tmp;
- unsigned int i;
-
- /* look for the id */
- for (i = 0; i < _Xthr_once_last_key_; i++)
- if (_Xthr_once_keys_[i] == id)
- return 0;
- /* allocate more room if needed */
- if ((_Xthr_once_last_key_ % XTHR_ONCE_KEYS_CHUNK) == 0) {
- tmp = realloc(_Xthr_once_keys_,
- (_Xthr_once_last_key_ + XTHR_ONCE_KEYS_CHUNK)*sizeof(void *));
- if (tmp == NULL) {
- return ENOMEM;
- }
- for (i = 0; i < XTHR_ONCE_KEYS_CHUNK; i++)
- tmp[_Xthr_once_last_key_ + i] = NULL;
- _Xthr_once_keys_ = tmp;
- }
- /* call the routine */
- routine();
- /* Mark it */
- _Xthr_once_keys_[_Xthr_once_last_key_++] = id;
- return 0;
-}
-
-#define XTHR_KEYS_CHUNK 100
-
-static void **_Xthr_keys_ = NULL;
-static unsigned int _Xthr_last_key_ = 0;
-
-static int
-_Xthr_key_create_stub_(unsigned int *key, void (*destructor)(void *))
-{
- void **tmp;
- unsigned int i;
-
- if ((_Xthr_last_key_ % XTHR_KEYS_CHUNK) == 0) {
- tmp = realloc(_Xthr_keys_,
- (_Xthr_last_key_ + XTHR_KEYS_CHUNK)*sizeof(void *));
- if (tmp == NULL) {
- return ENOMEM;
- }
- for (i = 0; i < XTHR_KEYS_CHUNK; i++)
- tmp[_Xthr_last_key_ + i] = NULL;
- _Xthr_keys_ = tmp;
- }
- *key = _Xthr_last_key_++;
- return 0;
-}
-
-static int
-_Xthr_setspecific_stub_(unsigned int key, const void *value)
-{
- if (_Xthr_last_key_ == 0 || key >= _Xthr_last_key_)
- return EINVAL;
- _Xthr_keys_[key] = value;
- return 0;
-}
-
-static void *
-_Xthr_getspecific_stub_(unsigned int key)
-{
- if (_Xthr_last_key_ == 0 || key >= _Xthr_last_key_)
- return NULL;
- return(_Xthr_keys_[key]);
-}