aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2003-10-24 12:21:18 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2003-10-24 12:21:18 +0000
commitbf22935f99c213b406b368ccdbff2572a8d08df0 (patch)
tree2818c4d5402306973686db89f95f927a4b1c615b
parente194201cb6d05c31ca9b908bfbf6d54611ffeb64 (diff)
downloadgcc-bf22935f99c213b406b368ccdbff2572a8d08df0.zip
gcc-bf22935f99c213b406b368ccdbff2572a8d08df0.tar.gz
gcc-bf22935f99c213b406b368ccdbff2572a8d08df0.tar.bz2
locale_facets.tcc (money_get::do_get(..., string_type&): Minor tweak to the previous commit.
2003-10-24 Paolo Carlini <pcarlini@suse.de> * include/bits/locale_facets.tcc (money_get::do_get(..., string_type&): Minor tweak to the previous commit. From-SVN: r72892
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/bits/locale_facets.tcc45
2 files changed, 26 insertions, 24 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7842ab5..2b96b00 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,6 +1,11 @@
2003-10-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (money_get::do_get(...,
+ string_type&): Minor tweak to the previous commit.
+
+2003-10-24 Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/locale_facets.tcc (money_get::do_get(...,
string_type&): Disregard the previous commit: doesn't hurt but
doesn't accomplish anything useful either. This is the right
one, speeding up greatly the function in case of early fail.
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index f025c51..5e8128e 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -1284,7 +1284,7 @@ namespace std
__testvalid = false;
}
- if (__testvalid)
+ if (__testvalid && __tmp_units.size())
{
const char_type __zero = __ctype.widen('0');
@@ -1297,33 +1297,30 @@ namespace std
__tmp_units.erase(0, __only_zeros ? __tmp_units.size() - 1
: __first);
}
+
+ // 22.2.6.1.2, p4
+ if (__sign.size() && __sign == __neg_sign
+ && __tmp_units[0] != __zero)
+ __tmp_units.insert(__tmp_units.begin(), __ctype.widen('-'));
- if (__tmp_units.size())
+ // Test for grouping fidelity.
+ if (__grouping.size() && __grouping_tmp.size())
{
- // 22.2.6.1.2, p4
- if (__sign.size() && __sign == __neg_sign
- && __tmp_units[0] != __zero)
- __tmp_units.insert(__tmp_units.begin(), __ctype.widen('-'));
-
- // Test for grouping fidelity.
- if (__grouping.size() && __grouping_tmp.size())
- {
- if (!std::__verify_grouping(__grouping, __grouping_tmp))
- __testvalid = false;
- }
-
- // Iff not enough digits were supplied after the decimal-point.
- if (__testdecfound)
- {
- const int __frac = __intl ? __mpt.frac_digits()
- : __mpf.frac_digits();
- if (__frac > 0 && __sep_pos != __frac)
- __testvalid = false;
- }
+ if (!std::__verify_grouping(__grouping, __grouping_tmp))
+ __testvalid = false;
+ }
+
+ // Iff not enough digits were supplied after the decimal-point.
+ if (__testdecfound)
+ {
+ const int __frac = __intl ? __mpt.frac_digits()
+ : __mpf.frac_digits();
+ if (__frac > 0 && __sep_pos != __frac)
+ __testvalid = false;
}
- else
- __testvalid = false;
}
+ else
+ __testvalid = false;
// Iff no more characters are available.
if (__c == __eof)