+#ifndef NO_FLOATING_POINT
+/*
+ * Maintain a per-thread parsefloat buffer, shared by __svfscanf_l and
+ * __vfwscanf.
+ */
+#ifdef BUILDING_VARIANT
+extern char *__parsefloat_buf(size_t s);
+#else /* !BUILDING_VARIANT */
+__private_extern__ char *
+__parsefloat_buf(size_t s)
+{
+ char *b;
+ static pthread_key_t parsefloat_tsd_key = (pthread_key_t)-1;
+ static pthread_mutex_t parsefloat_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
+ static size_t bsiz = 0;
+
+ if (parsefloat_tsd_key == (pthread_key_t)-1) {
+ pthread_mutex_lock(&parsefloat_tsd_lock);
+ if (parsefloat_tsd_key == (pthread_key_t)-1) {
+ parsefloat_tsd_key = __LIBC_PTHREAD_KEY_PARSEFLOAT;
+ pthread_key_init_np(parsefloat_tsd_key, free);
+ }
+ pthread_mutex_unlock(&parsefloat_tsd_lock);
+ }
+ if ((b = (char *)pthread_getspecific(parsefloat_tsd_key)) == NULL) {
+ bsiz = s > BUF ? s : BUF;
+ b = (char *)malloc(bsiz);
+ if (b == NULL) {
+ bsiz = 0;
+ return NULL;
+ }
+ pthread_setspecific(parsefloat_tsd_key, b);
+ return b;
+ }
+ if (s > bsiz) {
+ b = (char *)reallocf(b, s);
+ pthread_setspecific(parsefloat_tsd_key, b);
+ if (b == NULL) {
+ bsiz = 0;
+ return NULL;
+ }
+ bsiz = s;
+ }
+ return b;
+}
+#endif /* BUILDING_VARIANT */
+