[libcxx] r199541 - Update __parse_DUP_COUNT and __parse_BACKREF to use the traits class to recognize digits. Fixes PR18514
Marshall Clow
mclow.lists at gmail.com
Fri Jan 17 19:40:03 PST 2014
Author: marshall
Date: Fri Jan 17 21:40:03 2014
New Revision: 199541
URL: http://llvm.org/viewvc/llvm-project?rev=199541&view=rev
Log:
Update __parse_DUP_COUNT and __parse_BACKREF to use the traits class to recognize digits. Fixes PR18514
Modified:
libcxx/trunk/include/regex
Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=199541&r1=199540&r2=199541&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Fri Jan 17 21:40:03 2014
@@ -3310,10 +3310,14 @@ basic_regex<_CharT, _Traits>::__parse_BA
_ForwardIterator __temp = _VSTD::next(__first);
if (__temp != __last)
{
- if (*__first == '\\' && '1' <= *__temp && *__temp <= '9')
- {
- __push_back_ref(*__temp - '0');
- __first = ++__temp;
+ if (*__first == '\\')
+ {
+ int __val = __traits_.value(*__temp, 10);
+ if (__val >= 1 && __val <= 9)
+ {
+ __push_back_ref(__val);
+ __first = ++__temp;
+ }
}
}
}
@@ -4052,14 +4056,19 @@ basic_regex<_CharT, _Traits>::__parse_DU
_ForwardIterator __last,
int& __c)
{
- if (__first != __last && '0' <= *__first && *__first <= '9')
+ if (__first != __last )
{
- __c = *__first - '0';
- for (++__first; __first != __last && '0' <= *__first && *__first <= '9';
- ++__first)
+ int __val = __traits_.value(*__first, 10);
+ if ( __val != -1 )
{
- __c *= 10;
- __c += *__first - '0';
+ __c = __val;
+ for (++__first;
+ __first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
+ ++__first)
+ {
+ __c *= 10;
+ __c += __val;
+ }
}
}
return __first;
More information about the cfe-commits
mailing list