+ struct __xlocale_st_numeric *xp;
+ static struct __xlocale_st_numeric *cache = NULL;
+
+ /* 'name' must be already checked. */
+ if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+ if (!loc->_numeric_using_locale)
+ return (_LDP_CACHE);
+ loc->_numeric_using_locale = 0;
+ XL_RELEASE(loc->__lc_numeric);
+ loc->__lc_numeric = NULL;
+ loc->__nlocale_changed = 1;
+ return (_LDP_CACHE);
+ }
+
+ if (loc->_numeric_using_locale && strcmp(name, loc->__lc_numeric->_numeric_locale_buf) == 0)
+ return (_LDP_CACHE);
+ /*
+ * If the locale name is the same as our cache, use the cache.
+ */
+ if (cache && cache->_numeric_locale_buf && strcmp(name, cache->_numeric_locale_buf) == 0) {
+ loc->_numeric_using_locale = 1;
+ XL_RELEASE(loc->__lc_numeric);
+ loc->__lc_numeric = cache;
+ XL_RETAIN(loc->__lc_numeric);
+ loc->__nlocale_changed = 1;
+ return (_LDP_CACHE);
+ }
+ if ((xp = (struct __xlocale_st_numeric *)malloc(sizeof(*xp))) == NULL)
+ return _LDP_ERROR;
+ xp->__refcount = 1;
+ xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
+ xp->_numeric_locale_buf = NULL;