mirror of
https://github.com/boostorg/regex.git
synced 2025-07-15 05:16:37 +02:00
Added more error checking for no-eh builds.
[SVN r12870]
This commit is contained in:
@ -1075,6 +1075,7 @@ template <class iterator, class Allocator>
|
|||||||
match_results_base<iterator, Allocator>::match_results_base(const Allocator& a)
|
match_results_base<iterator, Allocator>::match_results_base(const Allocator& a)
|
||||||
{
|
{
|
||||||
ref = (c_reference*)c_alloc(a).allocate(sizeof(sub_match<iterator>) + sizeof(c_reference));
|
ref = (c_reference*)c_alloc(a).allocate(sizeof(sub_match<iterator>) + sizeof(c_reference));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(ref)
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1166,6 +1167,7 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
|
|||||||
if(ref->cmatches != n)
|
if(ref->cmatches != n)
|
||||||
{
|
{
|
||||||
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(c_reference));
|
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(c_reference));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(newref)
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1217,7 +1219,8 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_typ
|
|||||||
{
|
{
|
||||||
if(ref->cmatches != n)
|
if(ref->cmatches != n)
|
||||||
{
|
{
|
||||||
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(c_reference));;
|
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(c_reference));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(newref)
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try{
|
try{
|
||||||
#endif
|
#endif
|
||||||
@ -1332,6 +1335,7 @@ void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::cow()
|
|||||||
if(ref->count > 1)
|
if(ref->count > 1)
|
||||||
{
|
{
|
||||||
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference));
|
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(newref)
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try{
|
try{
|
||||||
#endif
|
#endif
|
||||||
@ -1460,6 +1464,7 @@ match_results<iterator, Allocator>::match_results(const match_results<iterator,
|
|||||||
reinterpret_cast<typename re_detail::match_results_base<iterator, Allocator>::c_reference *>
|
reinterpret_cast<typename re_detail::match_results_base<iterator, Allocator>::c_reference *>
|
||||||
(m.ref->allocate(sizeof(sub_match<iterator>) * m.ref->cmatches +
|
(m.ref->allocate(sizeof(sub_match<iterator>) * m.ref->cmatches +
|
||||||
sizeof(typename re_detail::match_results_base<iterator, Allocator>::c_reference)));
|
sizeof(typename re_detail::match_results_base<iterator, Allocator>::c_reference)));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(this->ref)
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try{
|
try{
|
||||||
#endif
|
#endif
|
||||||
|
@ -1172,6 +1172,7 @@ void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_apply(re_d
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
pb = a.allocate(cbraces);
|
pb = a.allocate(cbraces);
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(pb)
|
||||||
for(unsigned i = 0; i < cbraces; ++i)
|
for(unsigned i = 0; i < cbraces; ++i)
|
||||||
pb[i] = false;
|
pb[i] = false;
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans transla
|
|||||||
// allocate struct and fill it in:
|
// allocate struct and fill it in:
|
||||||
//
|
//
|
||||||
kmp_info<charT>* pinfo = reinterpret_cast<kmp_info<charT>*>(atype(a).allocate(size));
|
kmp_info<charT>* pinfo = reinterpret_cast<kmp_info<charT>*>(atype(a).allocate(size));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(pinfo)
|
||||||
pinfo->size = size;
|
pinfo->size = size;
|
||||||
pinfo->len = m;
|
pinfo->len = m;
|
||||||
charT* p = reinterpret_cast<charT*>(reinterpret_cast<char*>(pinfo) + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
|
charT* p = reinterpret_cast<charT*>(reinterpret_cast<char*>(pinfo) + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
|
||||||
|
@ -215,7 +215,9 @@ void _priv_match_data<iterator, Allocator>::set_accumulator_size(unsigned int si
|
|||||||
m_free();
|
m_free();
|
||||||
caccumulators = size;
|
caccumulators = size;
|
||||||
accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators);
|
accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators);
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(accumulators)
|
||||||
loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators);
|
loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators);
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(loop_starts)
|
||||||
for(unsigned i = 0; i < caccumulators; ++i)
|
for(unsigned i = 0; i < caccumulators; ++i)
|
||||||
new (loop_starts + i) iterator();
|
new (loop_starts + i) iterator();
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,7 @@ raw_storage<Allocator>::raw_storage(const Allocator& a)
|
|||||||
: alloc_inst(a)
|
: alloc_inst(a)
|
||||||
{
|
{
|
||||||
start = end = alloc_inst.allocate(1024);
|
start = end = alloc_inst.allocate(1024);
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(start)
|
||||||
alloc_inst.last = start + 1024;
|
alloc_inst.last = start + 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,6 +188,7 @@ raw_storage<Allocator>::raw_storage(size_type n, const Allocator& a)
|
|||||||
: alloc_inst(a)
|
: alloc_inst(a)
|
||||||
{
|
{
|
||||||
start = end = alloc_inst.allocate(n);
|
start = end = alloc_inst.allocate(n);
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(start)
|
||||||
alloc_inst.last = start + n;
|
alloc_inst.last = start + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +210,7 @@ void BOOST_REGEX_CALL raw_storage<Allocator>::resize(size_type n)
|
|||||||
|
|
||||||
// allocate and copy data:
|
// allocate and copy data:
|
||||||
register unsigned char* ptr = alloc_inst.allocate(newsize);
|
register unsigned char* ptr = alloc_inst.allocate(newsize);
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(ptr)
|
||||||
std::memcpy(ptr, start, datasize);
|
std::memcpy(ptr, start, datasize);
|
||||||
|
|
||||||
// get rid of old buffer:
|
// get rid of old buffer:
|
||||||
|
@ -85,6 +85,7 @@ public:
|
|||||||
node* BOOST_REGEX_CALL get_node()
|
node* BOOST_REGEX_CALL get_node()
|
||||||
{
|
{
|
||||||
node* new_stack = reinterpret_cast<node*>(alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size));
|
node* new_stack = reinterpret_cast<node*>(alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size));
|
||||||
|
BOOST_REGEX_NOEH_ASSERT(new_stack)
|
||||||
new_stack->last = reinterpret_cast<T*>(new_stack+1);
|
new_stack->last = reinterpret_cast<T*>(new_stack+1);
|
||||||
new_stack->start = new_stack->end = new_stack->last + block_size;
|
new_stack->start = new_stack->end = new_stack->last + block_size;
|
||||||
new_stack->next = 0;
|
new_stack->next = 0;
|
||||||
|
Reference in New Issue
Block a user