xref: /dflybsd-src/contrib/gcc-4.7/libstdc++-v3/src/c++98/localename.cc (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2*e4b17023SJohn Marino // 2006, 2007, 2008, 2009, 2010
3*e4b17023SJohn Marino // Free Software Foundation, Inc.
4*e4b17023SJohn Marino //
5*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library.  This library is free
6*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the
7*e4b17023SJohn Marino // terms of the GNU General Public License as published by the
8*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option)
9*e4b17023SJohn Marino // any later version.
10*e4b17023SJohn Marino 
11*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful,
12*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*e4b17023SJohn Marino // GNU General Public License for more details.
15*e4b17023SJohn Marino 
16*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional
17*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version
18*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation.
19*e4b17023SJohn Marino 
20*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and
21*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program;
22*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>.
24*e4b17023SJohn Marino 
25*e4b17023SJohn Marino #include <clocale>
26*e4b17023SJohn Marino #include <cstring>
27*e4b17023SJohn Marino #include <cstdlib>
28*e4b17023SJohn Marino #include <locale>
29*e4b17023SJohn Marino 
30*e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default)
31*e4b17023SJohn Marino {
32*e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_VERSION
33*e4b17023SJohn Marino 
34*e4b17023SJohn Marino   using namespace __gnu_cxx;
35*e4b17023SJohn Marino 
locale(const char * __s)36*e4b17023SJohn Marino   locale::locale(const char* __s) : _M_impl(0)
37*e4b17023SJohn Marino   {
38*e4b17023SJohn Marino     if (__s)
39*e4b17023SJohn Marino       {
40*e4b17023SJohn Marino 	_S_initialize();
41*e4b17023SJohn Marino 	if (std::strcmp(__s, "C") == 0 || std::strcmp(__s, "POSIX") == 0)
42*e4b17023SJohn Marino 	  (_M_impl = _S_classic)->_M_add_reference();
43*e4b17023SJohn Marino 	else if (std::strcmp(__s, "") != 0)
44*e4b17023SJohn Marino 	  _M_impl = new _Impl(__s, 1);
45*e4b17023SJohn Marino 	else
46*e4b17023SJohn Marino 	  {
47*e4b17023SJohn Marino 	    // Get it from the environment.
48*e4b17023SJohn Marino 	    char* __env = std::getenv("LC_ALL");
49*e4b17023SJohn Marino 	    // If LC_ALL is set we are done.
50*e4b17023SJohn Marino 	    if (__env && std::strcmp(__env, "") != 0)
51*e4b17023SJohn Marino 	      {
52*e4b17023SJohn Marino 		if (std::strcmp(__env, "C") == 0
53*e4b17023SJohn Marino 		    || std::strcmp(__env, "POSIX") == 0)
54*e4b17023SJohn Marino 		  (_M_impl = _S_classic)->_M_add_reference();
55*e4b17023SJohn Marino 		else
56*e4b17023SJohn Marino 		  _M_impl = new _Impl(__env, 1);
57*e4b17023SJohn Marino 	      }
58*e4b17023SJohn Marino 	    else
59*e4b17023SJohn Marino 	      {
60*e4b17023SJohn Marino 		// LANG may set a default different from "C".
61*e4b17023SJohn Marino 		string __lang;
62*e4b17023SJohn Marino 		__env = std::getenv("LANG");
63*e4b17023SJohn Marino 		if (!__env || std::strcmp(__env, "") == 0
64*e4b17023SJohn Marino 		    || std::strcmp(__env, "C") == 0
65*e4b17023SJohn Marino 		    || std::strcmp(__env, "POSIX") == 0)
66*e4b17023SJohn Marino 		  __lang = "C";
67*e4b17023SJohn Marino 		else
68*e4b17023SJohn Marino 		  __lang = __env;
69*e4b17023SJohn Marino 
70*e4b17023SJohn Marino 		// Scan the categories looking for the first one
71*e4b17023SJohn Marino 		// different from LANG.
72*e4b17023SJohn Marino 		size_t __i = 0;
73*e4b17023SJohn Marino 		if (__lang == "C")
74*e4b17023SJohn Marino 		  for (; __i < _S_categories_size; ++__i)
75*e4b17023SJohn Marino 		    {
76*e4b17023SJohn Marino 		      __env = std::getenv(_S_categories[__i]);
77*e4b17023SJohn Marino 		      if (__env && std::strcmp(__env, "") != 0
78*e4b17023SJohn Marino 			  && std::strcmp(__env, "C") != 0
79*e4b17023SJohn Marino 			  && std::strcmp(__env, "POSIX") != 0)
80*e4b17023SJohn Marino 			break;
81*e4b17023SJohn Marino 		    }
82*e4b17023SJohn Marino 		else
83*e4b17023SJohn Marino 		  for (; __i < _S_categories_size; ++__i)
84*e4b17023SJohn Marino 		    {
85*e4b17023SJohn Marino 		      __env = std::getenv(_S_categories[__i]);
86*e4b17023SJohn Marino 		      if (__env && std::strcmp(__env, "") != 0
87*e4b17023SJohn Marino 			  && __lang != __env)
88*e4b17023SJohn Marino 			break;
89*e4b17023SJohn Marino 		    }
90*e4b17023SJohn Marino 
91*e4b17023SJohn Marino 		// If one is found, build the complete string of
92*e4b17023SJohn Marino 		// the form LC_CTYPE=xxx;LC_NUMERIC=yyy; and so on...
93*e4b17023SJohn Marino 		if (__i < _S_categories_size)
94*e4b17023SJohn Marino 		  {
95*e4b17023SJohn Marino 		    string __str;
96*e4b17023SJohn Marino 		    __str.reserve(128);
97*e4b17023SJohn Marino 		    for (size_t __j = 0; __j < __i; ++__j)
98*e4b17023SJohn Marino 		      {
99*e4b17023SJohn Marino 			__str += _S_categories[__j];
100*e4b17023SJohn Marino 			__str += '=';
101*e4b17023SJohn Marino 			__str += __lang;
102*e4b17023SJohn Marino 			__str += ';';
103*e4b17023SJohn Marino 		      }
104*e4b17023SJohn Marino 		    __str += _S_categories[__i];
105*e4b17023SJohn Marino 		    __str += '=';
106*e4b17023SJohn Marino 		    __str += __env;
107*e4b17023SJohn Marino 		    __str += ';';
108*e4b17023SJohn Marino 		    ++__i;
109*e4b17023SJohn Marino 		    for (; __i < _S_categories_size; ++__i)
110*e4b17023SJohn Marino 		      {
111*e4b17023SJohn Marino 			__env = std::getenv(_S_categories[__i]);
112*e4b17023SJohn Marino 			__str += _S_categories[__i];
113*e4b17023SJohn Marino 			if (!__env || std::strcmp(__env, "") == 0)
114*e4b17023SJohn Marino 			  {
115*e4b17023SJohn Marino 			    __str += '=';
116*e4b17023SJohn Marino 			    __str += __lang;
117*e4b17023SJohn Marino 			    __str += ';';
118*e4b17023SJohn Marino 			  }
119*e4b17023SJohn Marino 			else if (std::strcmp(__env, "C") == 0
120*e4b17023SJohn Marino 				 || std::strcmp(__env, "POSIX") == 0)
121*e4b17023SJohn Marino 			  __str += "=C;";
122*e4b17023SJohn Marino 			else
123*e4b17023SJohn Marino 			  {
124*e4b17023SJohn Marino 			    __str += '=';
125*e4b17023SJohn Marino 			    __str += __env;
126*e4b17023SJohn Marino 			    __str += ';';
127*e4b17023SJohn Marino 			  }
128*e4b17023SJohn Marino 		      }
129*e4b17023SJohn Marino 		    __str.erase(__str.end() - 1);
130*e4b17023SJohn Marino 		    _M_impl = new _Impl(__str.c_str(), 1);
131*e4b17023SJohn Marino 		  }
132*e4b17023SJohn Marino 		// ... otherwise either an additional instance of
133*e4b17023SJohn Marino 		// the "C" locale or LANG.
134*e4b17023SJohn Marino 		else if (__lang == "C")
135*e4b17023SJohn Marino 		  (_M_impl = _S_classic)->_M_add_reference();
136*e4b17023SJohn Marino 		else
137*e4b17023SJohn Marino 		  _M_impl = new _Impl(__lang.c_str(), 1);
138*e4b17023SJohn Marino 	      }
139*e4b17023SJohn Marino 	  }
140*e4b17023SJohn Marino       }
141*e4b17023SJohn Marino     else
142*e4b17023SJohn Marino       __throw_runtime_error(__N("locale::locale null not valid"));
143*e4b17023SJohn Marino   }
144*e4b17023SJohn Marino 
locale(const locale & __base,const char * __s,category __cat)145*e4b17023SJohn Marino   locale::locale(const locale& __base, const char* __s, category __cat)
146*e4b17023SJohn Marino   : _M_impl(0)
147*e4b17023SJohn Marino   {
148*e4b17023SJohn Marino     // NB: There are complicated, yet more efficient ways to do
149*e4b17023SJohn Marino     // this. Building up locales on a per-category way is tedious, so
150*e4b17023SJohn Marino     // let's do it this way until people complain.
151*e4b17023SJohn Marino     locale __add(__s);
152*e4b17023SJohn Marino     _M_coalesce(__base, __add, __cat);
153*e4b17023SJohn Marino   }
154*e4b17023SJohn Marino 
locale(const locale & __base,const locale & __add,category __cat)155*e4b17023SJohn Marino   locale::locale(const locale& __base, const locale& __add, category __cat)
156*e4b17023SJohn Marino   : _M_impl(0)
157*e4b17023SJohn Marino   { _M_coalesce(__base, __add, __cat); }
158*e4b17023SJohn Marino 
159*e4b17023SJohn Marino   void
_M_coalesce(const locale & __base,const locale & __add,category __cat)160*e4b17023SJohn Marino   locale::_M_coalesce(const locale& __base, const locale& __add,
161*e4b17023SJohn Marino 		      category __cat)
162*e4b17023SJohn Marino   {
163*e4b17023SJohn Marino     __cat = _S_normalize_category(__cat);
164*e4b17023SJohn Marino     _M_impl = new _Impl(*__base._M_impl, 1);
165*e4b17023SJohn Marino 
166*e4b17023SJohn Marino     __try
167*e4b17023SJohn Marino       { _M_impl->_M_replace_categories(__add._M_impl, __cat); }
168*e4b17023SJohn Marino     __catch(...)
169*e4b17023SJohn Marino       {
170*e4b17023SJohn Marino 	_M_impl->_M_remove_reference();
171*e4b17023SJohn Marino 	__throw_exception_again;
172*e4b17023SJohn Marino       }
173*e4b17023SJohn Marino   }
174*e4b17023SJohn Marino 
175*e4b17023SJohn Marino   // Construct named _Impl.
176*e4b17023SJohn Marino   locale::_Impl::
_Impl(const char * __s,size_t __refs)177*e4b17023SJohn Marino   _Impl(const char* __s, size_t __refs)
178*e4b17023SJohn Marino   : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
179*e4b17023SJohn Marino     _M_caches(0), _M_names(0)
180*e4b17023SJohn Marino   {
181*e4b17023SJohn Marino     // Initialize the underlying locale model, which also checks to
182*e4b17023SJohn Marino     // see if the given name is valid.
183*e4b17023SJohn Marino     __c_locale __cloc;
184*e4b17023SJohn Marino     locale::facet::_S_create_c_locale(__cloc, __s);
185*e4b17023SJohn Marino     __c_locale __clocm = __cloc;
186*e4b17023SJohn Marino 
187*e4b17023SJohn Marino     __try
188*e4b17023SJohn Marino       {
189*e4b17023SJohn Marino 	_M_facets = new const facet*[_M_facets_size];
190*e4b17023SJohn Marino 	for (size_t __i = 0; __i < _M_facets_size; ++__i)
191*e4b17023SJohn Marino 	  _M_facets[__i] = 0;
192*e4b17023SJohn Marino 	_M_caches = new const facet*[_M_facets_size];
193*e4b17023SJohn Marino 	for (size_t __j = 0; __j < _M_facets_size; ++__j)
194*e4b17023SJohn Marino 	  _M_caches[__j] = 0;
195*e4b17023SJohn Marino 	_M_names = new char*[_S_categories_size];
196*e4b17023SJohn Marino 	for (size_t __k = 0; __k < _S_categories_size; ++__k)
197*e4b17023SJohn Marino 	  _M_names[__k] = 0;
198*e4b17023SJohn Marino 
199*e4b17023SJohn Marino 	// Name the categories.
200*e4b17023SJohn Marino 	const char* __smon = __s;
201*e4b17023SJohn Marino 	const size_t __len = std::strlen(__s);
202*e4b17023SJohn Marino 	if (!std::memchr(__s, ';', __len))
203*e4b17023SJohn Marino 	  {
204*e4b17023SJohn Marino 	    _M_names[0] = new char[__len + 1];
205*e4b17023SJohn Marino 	    std::memcpy(_M_names[0], __s, __len + 1);
206*e4b17023SJohn Marino 	  }
207*e4b17023SJohn Marino 	else
208*e4b17023SJohn Marino 	  {
209*e4b17023SJohn Marino 	    const char* __end = __s;
210*e4b17023SJohn Marino 	    bool __found_ctype = false;
211*e4b17023SJohn Marino 	    bool __found_monetary = false;
212*e4b17023SJohn Marino 	    size_t __ci = 0, __mi = 0;
213*e4b17023SJohn Marino 	    for (size_t __i = 0; __i < _S_categories_size; ++__i)
214*e4b17023SJohn Marino 	      {
215*e4b17023SJohn Marino 		const char* __beg = std::strchr(__end + 1, '=') + 1;
216*e4b17023SJohn Marino 		__end = std::strchr(__beg, ';');
217*e4b17023SJohn Marino 		if (!__end)
218*e4b17023SJohn Marino 		  __end = __s + __len;
219*e4b17023SJohn Marino 		_M_names[__i] = new char[__end - __beg + 1];
220*e4b17023SJohn Marino 		std::memcpy(_M_names[__i], __beg, __end - __beg);
221*e4b17023SJohn Marino 		_M_names[__i][__end - __beg] = '\0';
222*e4b17023SJohn Marino 		if (!__found_ctype
223*e4b17023SJohn Marino 		    && *(__beg - 2) == 'E' && *(__beg - 3) == 'P')
224*e4b17023SJohn Marino 		  {
225*e4b17023SJohn Marino 		    __found_ctype = true;
226*e4b17023SJohn Marino 		    __ci = __i;
227*e4b17023SJohn Marino 		  }
228*e4b17023SJohn Marino 		else if (!__found_monetary && *(__beg - 2) == 'Y')
229*e4b17023SJohn Marino 		  {
230*e4b17023SJohn Marino 		    __found_monetary = true;
231*e4b17023SJohn Marino 		    __mi = __i;
232*e4b17023SJohn Marino 		  }
233*e4b17023SJohn Marino 	      }
234*e4b17023SJohn Marino 
235*e4b17023SJohn Marino 	    if (std::strcmp(_M_names[__ci], _M_names[__mi]))
236*e4b17023SJohn Marino 	      {
237*e4b17023SJohn Marino 		__smon = _M_names[__mi];
238*e4b17023SJohn Marino 		__clocm = locale::facet::_S_lc_ctype_c_locale(__cloc,
239*e4b17023SJohn Marino 							      __smon);
240*e4b17023SJohn Marino 	      }
241*e4b17023SJohn Marino 	  }
242*e4b17023SJohn Marino 
243*e4b17023SJohn Marino 	// Construct all standard facets and add them to _M_facets.
244*e4b17023SJohn Marino 	_M_init_facet(new std::ctype<char>(__cloc, 0, false));
245*e4b17023SJohn Marino 	_M_init_facet(new codecvt<char, char, mbstate_t>(__cloc));
246*e4b17023SJohn Marino 	_M_init_facet(new numpunct<char>(__cloc));
247*e4b17023SJohn Marino 	_M_init_facet(new num_get<char>);
248*e4b17023SJohn Marino 	_M_init_facet(new num_put<char>);
249*e4b17023SJohn Marino 	_M_init_facet(new std::collate<char>(__cloc));
250*e4b17023SJohn Marino 	_M_init_facet(new moneypunct<char, false>(__cloc, 0));
251*e4b17023SJohn Marino 	_M_init_facet(new moneypunct<char, true>(__cloc, 0));
252*e4b17023SJohn Marino 	_M_init_facet(new money_get<char>);
253*e4b17023SJohn Marino 	_M_init_facet(new money_put<char>);
254*e4b17023SJohn Marino 	_M_init_facet(new __timepunct<char>(__cloc, __s));
255*e4b17023SJohn Marino 	_M_init_facet(new time_get<char>);
256*e4b17023SJohn Marino 	_M_init_facet(new time_put<char>);
257*e4b17023SJohn Marino 	_M_init_facet(new std::messages<char>(__cloc, __s));
258*e4b17023SJohn Marino 
259*e4b17023SJohn Marino #ifdef  _GLIBCXX_USE_WCHAR_T
260*e4b17023SJohn Marino 	_M_init_facet(new std::ctype<wchar_t>(__cloc));
261*e4b17023SJohn Marino 	_M_init_facet(new codecvt<wchar_t, char, mbstate_t>(__cloc));
262*e4b17023SJohn Marino 	_M_init_facet(new numpunct<wchar_t>(__cloc));
263*e4b17023SJohn Marino 	_M_init_facet(new num_get<wchar_t>);
264*e4b17023SJohn Marino 	_M_init_facet(new num_put<wchar_t>);
265*e4b17023SJohn Marino 	_M_init_facet(new std::collate<wchar_t>(__cloc));
266*e4b17023SJohn Marino 	_M_init_facet(new moneypunct<wchar_t, false>(__clocm, __smon));
267*e4b17023SJohn Marino 	_M_init_facet(new moneypunct<wchar_t, true>(__clocm, __smon));
268*e4b17023SJohn Marino 	_M_init_facet(new money_get<wchar_t>);
269*e4b17023SJohn Marino 	_M_init_facet(new money_put<wchar_t>);
270*e4b17023SJohn Marino 	_M_init_facet(new __timepunct<wchar_t>(__cloc, __s));
271*e4b17023SJohn Marino 	_M_init_facet(new time_get<wchar_t>);
272*e4b17023SJohn Marino 	_M_init_facet(new time_put<wchar_t>);
273*e4b17023SJohn Marino 	_M_init_facet(new std::messages<wchar_t>(__cloc, __s));
274*e4b17023SJohn Marino #endif
275*e4b17023SJohn Marino 	locale::facet::_S_destroy_c_locale(__cloc);
276*e4b17023SJohn Marino 	if (__clocm != __cloc)
277*e4b17023SJohn Marino 	  locale::facet::_S_destroy_c_locale(__clocm);
278*e4b17023SJohn Marino       }
279*e4b17023SJohn Marino     __catch(...)
280*e4b17023SJohn Marino       {
281*e4b17023SJohn Marino 	locale::facet::_S_destroy_c_locale(__cloc);
282*e4b17023SJohn Marino 	if (__clocm != __cloc)
283*e4b17023SJohn Marino 	  locale::facet::_S_destroy_c_locale(__clocm);
284*e4b17023SJohn Marino 	this->~_Impl();
285*e4b17023SJohn Marino 	__throw_exception_again;
286*e4b17023SJohn Marino       }
287*e4b17023SJohn Marino   }
288*e4b17023SJohn Marino 
289*e4b17023SJohn Marino   void
290*e4b17023SJohn Marino   locale::_Impl::
_M_replace_categories(const _Impl * __imp,category __cat)291*e4b17023SJohn Marino   _M_replace_categories(const _Impl* __imp, category __cat)
292*e4b17023SJohn Marino   {
293*e4b17023SJohn Marino     category __mask = 1;
294*e4b17023SJohn Marino     if (!_M_names[0] || !__imp->_M_names[0])
295*e4b17023SJohn Marino       {
296*e4b17023SJohn Marino 	if (_M_names[0])
297*e4b17023SJohn Marino 	  {
298*e4b17023SJohn Marino 	    delete [] _M_names[0];
299*e4b17023SJohn Marino 	    _M_names[0] = 0;   // Unnamed.
300*e4b17023SJohn Marino 	  }
301*e4b17023SJohn Marino 
302*e4b17023SJohn Marino 	for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
303*e4b17023SJohn Marino 	  {
304*e4b17023SJohn Marino 	    if (__mask & __cat)
305*e4b17023SJohn Marino 	      // Need to replace entry in _M_facets with other locale's info.
306*e4b17023SJohn Marino 	      _M_replace_category(__imp, _S_facet_categories[__ix]);
307*e4b17023SJohn Marino 	  }
308*e4b17023SJohn Marino       }
309*e4b17023SJohn Marino     else
310*e4b17023SJohn Marino       {
311*e4b17023SJohn Marino 	if (!_M_names[1])
312*e4b17023SJohn Marino 	  {
313*e4b17023SJohn Marino 	    // A full set of _M_names must be prepared, all identical
314*e4b17023SJohn Marino 	    // to _M_names[0] to begin with. Then, below, a few will
315*e4b17023SJohn Marino 	    // be replaced by the corresponding __imp->_M_names. I.e.,
316*e4b17023SJohn Marino 	    // not a "simple" locale anymore (see locale::operator==).
317*e4b17023SJohn Marino 	    const size_t __len = std::strlen(_M_names[0]) + 1;
318*e4b17023SJohn Marino 	    for (size_t __i = 1; __i < _S_categories_size; ++__i)
319*e4b17023SJohn Marino 	      {
320*e4b17023SJohn Marino 		_M_names[__i] = new char[__len];
321*e4b17023SJohn Marino 		std::memcpy(_M_names[__i], _M_names[0], __len);
322*e4b17023SJohn Marino 	      }
323*e4b17023SJohn Marino 	  }
324*e4b17023SJohn Marino 
325*e4b17023SJohn Marino 	for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
326*e4b17023SJohn Marino 	  {
327*e4b17023SJohn Marino 	    if (__mask & __cat)
328*e4b17023SJohn Marino 	      {
329*e4b17023SJohn Marino 		// Need to replace entry in _M_facets with other locale's info.
330*e4b17023SJohn Marino 		_M_replace_category(__imp, _S_facet_categories[__ix]);
331*e4b17023SJohn Marino 
332*e4b17023SJohn Marino 		// FIXME: Hack for libstdc++/29217: the numerical encodings
333*e4b17023SJohn Marino 		// of the time and collate categories are swapped vs the
334*e4b17023SJohn Marino 		// order of the names in locale::_S_categories.  We'd like to
335*e4b17023SJohn Marino 		// adjust the former (the latter is dictated by compatibility
336*e4b17023SJohn Marino 		// with glibc) but we can't for binary compatibility.
337*e4b17023SJohn Marino 		size_t __ix_name = __ix;
338*e4b17023SJohn Marino 		if (__ix == 2 || __ix == 3)
339*e4b17023SJohn Marino 		  __ix_name = 5 - __ix;
340*e4b17023SJohn Marino 
341*e4b17023SJohn Marino 		char* __src = __imp->_M_names[__ix_name] ?
342*e4b17023SJohn Marino 		              __imp->_M_names[__ix_name] : __imp->_M_names[0];
343*e4b17023SJohn Marino 		const size_t __len = std::strlen(__src) + 1;
344*e4b17023SJohn Marino 		char* __new = new char[__len];
345*e4b17023SJohn Marino 		std::memcpy(__new, __src, __len);
346*e4b17023SJohn Marino 		delete [] _M_names[__ix_name];
347*e4b17023SJohn Marino 		_M_names[__ix_name] = __new;
348*e4b17023SJohn Marino 	      }
349*e4b17023SJohn Marino 	  }
350*e4b17023SJohn Marino       }
351*e4b17023SJohn Marino   }
352*e4b17023SJohn Marino 
353*e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_VERSION
354*e4b17023SJohn Marino } // namespace
355