aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2003-10-05 17:08:46 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2003-10-05 15:08:46 +0000
commit5b577977ea4e3b4bef007e2a34a7f46aeb2838f2 (patch)
tree1f5e700bbe053f942f5471838076bde1475062ca
parent368ebcd6ffb979a5b002835b03f75d61d681221d (diff)
downloadgcc-5b577977ea4e3b4bef007e2a34a7f46aeb2838f2.zip
gcc-5b577977ea4e3b4bef007e2a34a7f46aeb2838f2.tar.gz
gcc-5b577977ea4e3b4bef007e2a34a7f46aeb2838f2.tar.bz2
2003-10-05 Paolo Carlini <pcarlini@unitus.it>
* include/bits/locale_facets.tcc (num_put::do_put(..., bool)): Prefer ?: to if-else. (time_get::_M_extract_name): Qualify min with std::. (__pad<>::_S_pad): Constify two variables; simplify an if-else statement factoring out some code. * include/bits/locale_facets.tcc: Minor cosmetic changes. From-SVN: r72112
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc63
2 files changed, 36 insertions, 37 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index e286530..4944684 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2003-10-05 Paolo Carlini <pcarlini@unitus.it>
+
+ * include/bits/locale_facets.tcc
+ (num_put::do_put(..., bool)): Prefer ?: to if-else.
+ (time_get::_M_extract_name): Qualify min with std::.
+ (__pad<>::_S_pad): Constify two variables; simplify an
+ if-else statement factoring out some code.
+
+ * include/bits/locale_facets.tcc: Minor cosmetic changes.
+
2003-10-04 Paolo Carlini <pcarlini@unitus.it>
* include/bits/locale_facets.tcc (num_get::_M_extract_float):
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 0503c70..483d421 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -739,7 +739,7 @@ namespace std
else if (__flags & ios_base::showpos)
*__buf-- = __lit[__num_base::_S_oplus];
}
- else if (__basefield == ios_base::oct)
+ else if (__basefield == ios_base::oct)
{
// Octal.
do
@@ -793,13 +793,13 @@ namespace std
if (__basefield == ios_base::oct)
{
__off = 1;
- *__new = *__cs;
+ __new[0] = __cs[0];
}
else if (__basefield == ios_base::hex)
{
__off = 2;
- *__new = *__cs;
- *(__new + 1) = *(__cs + 1);
+ __new[0] = __cs[0];
+ __new[1] = __cs[1];
}
_CharT* __p;
__p = std::__add_grouping(__new + __off, __sep, __grouping.c_str(),
@@ -987,13 +987,13 @@ namespace std
_CharT* __ws2;
if (__lc->_M_use_grouping)
{
- // Grouping can add (almost) as many separators as the
- // number of digits, but no more.
- __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
- * __len * 2));
- _M_group_float(__lc->_M_grouping, __lc->_M_thousands_sep, __p,
- __ws2, __ws, __len);
- __ws = __ws2;
+ // Grouping can add (almost) as many separators as the
+ // number of digits, but no more.
+ __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __len * 2));
+ _M_group_float(__lc->_M_grouping, __lc->_M_thousands_sep, __p,
+ __ws2, __ws, __len);
+ __ws = __ws2;
}
// Pad.
@@ -1031,10 +1031,7 @@ namespace std
const __cache_type* __lc = __uc(__loc);
const _CharT* __name;
- if (__v)
- __name = __lc->_M_truename;
- else
- __name = __lc->_M_falsename;
+ __name = __v ? __lc->_M_truename : __lc->_M_falsename;
int __len = char_traits<_CharT>::length(__name);
_CharT* __cs;
@@ -1813,8 +1810,8 @@ namespace std
// Find smallest matching string.
size_t __minlen = 10;
for (size_t __i2 = 0; __i2 < __nmatches; ++__i2)
- __minlen = min(__minlen,
- __traits_type::length(__names[__matches[__i2]]));
+ __minlen = std::min(__minlen,
+ __traits_type::length(__names[__matches[__i2]]));
if (__pos < __minlen && __beg != __end)
{
@@ -2237,38 +2234,30 @@ namespace std
const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
const _CharT __minus = __ctype.widen('-');
const _CharT __plus = __ctype.widen('+');
- bool __testsign = _Traits::eq(__olds[0], __minus)
- || _Traits::eq(__olds[0], __plus);
+ const bool __testsign = _Traits::eq(__olds[0], __minus)
+ || _Traits::eq(__olds[0], __plus);
- bool __testhex = _Traits::eq(__ctype.widen('0'), __olds[0])
- && (_Traits::eq(__ctype.widen('x'), __olds[1])
- || _Traits::eq(__ctype.widen('X'), __olds[1]));
+ const bool __testhex = _Traits::eq(__ctype.widen('0'), __olds[0])
+ && (_Traits::eq(__ctype.widen('x'), __olds[1])
+ || _Traits::eq(__ctype.widen('X'), __olds[1]));
if (__testhex)
{
__news[0] = __olds[0];
__news[1] = __olds[1];
- __mod += 2;
+ __mod = 2;
__news += 2;
- __beg = __pads;
- __beglen = __plen;
- __end = const_cast<_CharT*>(__olds + __mod);
}
else if (__testsign)
{
__news[0] = __olds[0];
- ++__mod;
+ __mod = 1;
++__news;
- __beg = __pads;
- __beglen = __plen;
- __end = const_cast<_CharT*>(__olds + __mod);
- }
- else
- {
- // Padding first.
- __beg = __pads;
- __beglen = __plen;
- __end = const_cast<_CharT*>(__olds);
}
+ // else Padding first.
+
+ __beg = __pads;
+ __beglen = __plen;
+ __end = const_cast<_CharT*>(__olds + __mod);
}
else
{