Update of /cvsroot/boost/boost/boost/xpressive/detail/core
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17474

Modified Files:
      Tag: RC_1_34_0
        state.hpp 
Log Message:
fix for trac ticket 1026: regex_token_iterator crash

Index: state.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/state.hpp,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -d -r1.6 -r1.6.4.1
--- state.hpp   13 Feb 2006 01:05:37 -0000      1.6
+++ state.hpp   4 Jun 2007 19:16:45 -0000       1.6.4.1
@@ -107,7 +107,7 @@
     bool found_partial_match_;
 
     match_context context_;
-    results_extras &extras_;
+    results_extras *extras_;
     action_state action_state_;
 
     
///////////////////////////////////////////////////////////////////////////////
@@ -128,17 +128,17 @@
       , flags_(flags)
       , found_partial_match_(false)
       , context_() // zero-initializes the fields of context_
-      , extras_(core_access<BidiIter>::get_extras(what))
+      , extras_(&core_access<BidiIter>::get_extras(what))
       , action_state_(core_access<BidiIter>::get_action_state(what))
     {
         // reclaim any cached memory in the match_results struct
-        this->extras_.sub_match_stack_.unwind();
+        this->extras_->sub_match_stack_.unwind();
 
         // initialize the context_ struct
         this->init_(impl, what);
 
         // move all the nested match_results structs into the match_results 
cache
-        
this->extras_.results_cache_.reclaim_all(access::get_nested_results(what));
+        
this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
     }
 
     
///////////////////////////////////////////////////////////////////////////////
@@ -146,11 +146,12 @@
     //void reset(match_results &what, basic_regex const &rex)
     void reset(match_results &what, regex_impl const &impl)
     {
+        this->extras_ = &core_access<BidiIter>::get_extras(what);
         this->context_.prev_context_ = 0;
         this->found_partial_match_ = false;
-        this->extras_.sub_match_stack_.unwind();
+        this->extras_->sub_match_stack_.unwind();
         this->init_(impl, what);
-        
this->extras_.results_cache_.reclaim_all(access::get_nested_results(what));
+        
this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
     }
 
     
///////////////////////////////////////////////////////////////////////////////
@@ -163,7 +164,7 @@
 
         // create a new nested match_results for this regex
         nested_results<BidiIter> &nested = 
access::get_nested_results(*context.results_ptr_);
-        match_results &what = this->extras_.results_cache_.append_new(nested);
+        match_results &what = this->extras_->results_cache_.append_new(nested);
 
         // (re)initialize the match context
         this->init_(impl, what);
@@ -191,7 +192,7 @@
 
             // send the match_results struct back to the cache
             nested_results<BidiIter> &nested = 
access::get_nested_results(what);
-            this->extras_.results_cache_.reclaim_last(nested);
+            this->extras_->results_cache_.reclaim_last(nested);
         }
 
         // restore the state
@@ -255,7 +256,7 @@
         this->context_.results_ptr_ = &what;
         this->context_.traits_ = impl.traits_.get();
         this->mark_count_ = impl.mark_count_ + 1;
-        this->sub_matches_ = 
this->extras_.sub_match_stack_.push_sequence(total_mark_count);
+        this->sub_matches_ = 
this->extras_->sub_match_stack_.push_sequence(total_mark_count);
         this->sub_matches_ += impl.hidden_mark_count_;
 
         // initialize the match_results struct
@@ -264,7 +265,7 @@
 
     void uninit_(regex_impl const &impl, match_results &)
     {
-        extras_.sub_match_stack_.unwind_to(this->sub_matches_ - 
impl.hidden_mark_count_);
+        extras_->sub_match_stack_.unwind_to(this->sub_matches_ - 
impl.hidden_mark_count_);
     }
 
     bool found_partial_match()
@@ -292,7 +293,7 @@
 {
     memento<BidiIter> mem =
     {
-        state.extras_.sub_match_stack_.push_sequence(state.mark_count_, 
no_fill)
+        state.extras_->sub_match_stack_.push_sequence(state.mark_count_, 
no_fill)
       , state.context_.results_ptr_->nested_results().size()
     };
     std::copy(state.sub_matches_, state.sub_matches_ + state.mark_count_, 
mem.old_sub_matches_);
@@ -308,9 +309,9 @@
     typedef core_access<BidiIter> access;
     nested_results<BidiIter> &nested = 
access::get_nested_results(*state.context_.results_ptr_);
     std::size_t count = state.context_.results_ptr_->nested_results().size() - 
mem.nested_results_count_;
-    state.extras_.results_cache_.reclaim_last_n(nested, count);
+    state.extras_->results_cache_.reclaim_last_n(nested, count);
     std::copy(mem.old_sub_matches_, mem.old_sub_matches_ + state.mark_count_, 
state.sub_matches_);
-    state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
+    state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -322,7 +323,7 @@
     std::size_t count = state.context_.results_ptr_->nested_results().size() - 
mem.nested_results_count_;
     if(count == 0)
     {
-        state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
+        state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
     }
     // else we have we must orphan this block of backrefs because we are using 
the stack
     // space above it.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to