mirror of
https://github.com/boostorg/regex.git
synced 2025-07-17 14:22:08 +02:00
Fixed problem with wide character optimisations, changed asserts on pointers (HP-specific workaround).
[SVN r22721]
This commit is contained in:
@ -78,11 +78,11 @@ void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_sta
|
|||||||
difference_type dist = boost::re_detail::distance(base, last);
|
difference_type dist = boost::re_detail::distance(base, last);
|
||||||
traits_size_type states = static_cast<traits_size_type>(re.size());
|
traits_size_type states = static_cast<traits_size_type>(re.size());
|
||||||
states *= states;
|
states *= states;
|
||||||
difference_type lim = (std::numeric_limits<difference_type>::max)() - 1000 - states;
|
difference_type lim = (std::numeric_limits<difference_type>::max)() - 100000 - states;
|
||||||
if(dist > (difference_type)(lim / states))
|
if(dist > (difference_type)(lim / states))
|
||||||
max_state_count = lim;
|
max_state_count = lim;
|
||||||
else
|
else
|
||||||
max_state_count = 1000 + states * dist;
|
max_state_count = 100000 + states * dist;
|
||||||
}
|
}
|
||||||
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
template <class BidiIterator, class Allocator, class traits, class Allocator2>
|
||||||
void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_state_count(void*)
|
void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_state_count(void*)
|
||||||
|
@ -927,8 +927,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_si
|
|||||||
|
|
||||||
const re_repeat* rep = pmp->rep;
|
const re_repeat* rep = pmp->rep;
|
||||||
unsigned count = pmp->count;
|
unsigned count = pmp->count;
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
|
|
||||||
count -= rep->min;
|
count -= rep->min;
|
||||||
|
|
||||||
@ -977,8 +977,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_
|
|||||||
const re_repeat* rep = pmp->rep;
|
const re_repeat* rep = pmp->rep;
|
||||||
unsigned count = pmp->count;
|
unsigned count = pmp->count;
|
||||||
assert(rep->type == syntax_element_dot_rep);
|
assert(rep->type == syntax_element_dot_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_wild);
|
assert(rep->next.p->type == syntax_element_wild);
|
||||||
|
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
@ -1095,8 +1095,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repe
|
|||||||
position = pmp->last_position;
|
position = pmp->last_position;
|
||||||
|
|
||||||
assert(rep->type == syntax_element_char_rep);
|
assert(rep->type == syntax_element_char_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_literal);
|
assert(rep->next.p->type == syntax_element_literal);
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
|
|
||||||
@ -1159,8 +1159,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set
|
|||||||
position = pmp->last_position;
|
position = pmp->last_position;
|
||||||
|
|
||||||
assert(rep->type == syntax_element_short_set_rep);
|
assert(rep->type == syntax_element_short_set_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_set);
|
assert(rep->next.p->type == syntax_element_set);
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
|
|
||||||
@ -1223,8 +1223,8 @@ bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_
|
|||||||
position = pmp->last_position;
|
position = pmp->last_position;
|
||||||
|
|
||||||
assert(rep->type == syntax_element_long_set_rep);
|
assert(rep->type == syntax_element_long_set_rep);
|
||||||
assert(rep->next.p);
|
assert(rep->next.p != 0);
|
||||||
assert(rep->alt.p);
|
assert(rep->alt.p != 0);
|
||||||
assert(rep->next.p->type == syntax_element_long_set);
|
assert(rep->next.p->type == syntax_element_long_set);
|
||||||
assert(position != last);
|
assert(position != last);
|
||||||
assert(count < rep->max);
|
assert(count < rep->max);
|
||||||
|
@ -1066,7 +1066,7 @@ re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Alloca
|
|||||||
++csingles;
|
++csingles;
|
||||||
const traits_string_type& s = singles.peek();
|
const traits_string_type& s = singles.peek();
|
||||||
std::size_t len = (s.size() + 1) * sizeof(charT);
|
std::size_t len = (s.size() + 1) * sizeof(charT);
|
||||||
if(len > sizeof(charT))
|
if(len > sizeof(charT) * 2)
|
||||||
singleton = false;
|
singleton = false;
|
||||||
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
|
std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
|
||||||
singles.pop();
|
singles.pop();
|
||||||
|
Reference in New Issue
Block a user