#if !STDCPP_IMPLIB || !defined(_M_CEE_PURE)
_MRTIMP2 locale __cdecl locale::global(const locale& loc)
{
locale _Oldglobal;
_BEGIN_LOCK(_LOCK_LOCALE)
locale::_Locimp *_Ptr = _Getgloballocale();
if (_Ptr != loc._Ptr)
{
_DELETE_CRT(_Ptr->_Decref());
_Setgloballocale(_Ptr = loc._Ptr);
_Ptr->_Incref();
category _Cmask = _Ptr->_Catmask & all;
if (_Cmask == all)
setlocale(LC_ALL, _Ptr->_Name.c_str());
else
for (int catindex = 0; catindex <= _X_MAX; ++catindex)
if ((_CATMASK(catindex) & _Cmask) != 0)
setlocale(_CAT_TO_LC(catindex), _Ptr->_Name.c_str());
}
return (_Oldglobal);
_END_LOCK()
}
#endif // STDCPP_IMPLIB || !defined(_M_CEE_PURE)