Commit 57c4e0cd by Danny Smith Committed by Danny Smith

locale_facets.tcc (__convert_from_v): Replace strdup with ISO malloc and strcpy.

	* include/bits/locale_facets.tcc (__convert_from_v):
	Replace strdup with ISO malloc and strcpy.

From-SVN: r56991
parent 686f3bf0
2002-09-10 Danny Smith <dannysmith@users.sourceforge.net>
* include/bits/locale_facets.tcc (__convert_from_v):
Replace strdup with ISO malloc and strcpy.
2002-09-09 Benjamin Kosnik <bkoz@redhat.com> 2002-09-09 Benjamin Kosnik <bkoz@redhat.com>
* docs/html/configopts.html: Change grouping. Note ABI impacts. * docs/html/configopts.html: Change grouping. Note ABI impacts.
......
...@@ -1976,14 +1976,17 @@ namespace std ...@@ -1976,14 +1976,17 @@ namespace std
_Tv __v, const __c_locale&, int __prec = -1) _Tv __v, const __c_locale&, int __prec = -1)
{ {
int __ret; int __ret;
char* __old = strdup(setlocale(LC_ALL, NULL)); char* __old = setlocale(LC_ALL, NULL);
char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
if (__sav)
strcpy(__sav, __old);
setlocale(LC_ALL, "C"); setlocale(LC_ALL, "C");
if (__prec >= 0) if (__prec >= 0)
__ret = snprintf(__out, __size, __fmt, __prec, __v); __ret = snprintf(__out, __size, __fmt, __prec, __v);
else else
__ret = snprintf(__out, __size, __fmt, __v); __ret = snprintf(__out, __size, __fmt, __v);
setlocale(LC_ALL, __old); setlocale(LC_ALL, __sav);
free(__old); free(__sav);
return __ret; return __ret;
} }
#else #else
...@@ -1993,14 +1996,17 @@ namespace std ...@@ -1993,14 +1996,17 @@ namespace std
const __c_locale&, int __prec = -1) const __c_locale&, int __prec = -1)
{ {
int __ret; int __ret;
char* __old = strdup(setlocale(LC_ALL, NULL)); char* __old = setlocale(LC_ALL, NULL);
char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
if (__sav)
strcpy(__sav, __old);
setlocale(LC_ALL, "C"); setlocale(LC_ALL, "C");
if (__prec >= 0) if (__prec >= 0)
__ret = sprintf(__out, __fmt, __prec, __v); __ret = sprintf(__out, __fmt, __prec, __v);
else else
__ret = sprintf(__out, __fmt, __v); __ret = sprintf(__out, __fmt, __v);
setlocale(LC_ALL, __old); setlocale(LC_ALL, __sav);
free(__old); free(__sav);
return __ret; return __ret;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment