List:Commits« Previous MessageNext Message »
From:holyfoot Date:November 22 2007 4:17pm
Subject:bk commit into 5.1 tree (holyfoot:1.2594)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-22 20:17:17+04:00, holyfoot@stripped +2 -0
  fixes

  sql/gcalc_slicescan.cc@stripped, 2007-11-22 20:17:14+04:00, holyfoot@stripped +26 -9
    fixes

  sql/gcalc_slicescan.h@stripped, 2007-11-22 20:17:14+04:00, holyfoot@stripped +1 -0
    fixes

diff -Nrup a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
--- a/sql/gcalc_slicescan.cc	2007-06-14 14:08:26 +05:00
+++ b/sql/gcalc_slicescan.cc	2007-11-22 20:17:14 +04:00
@@ -34,13 +34,15 @@ gcalc_dyn_list::gcalc_dyn_list(size_t bl
 gcalc_dyn_list::item *gcalc_dyn_list::alloc_new_blk()
 {
   void *new_block= my_malloc(m_blk_size, MYF(MY_WME));
+  item *result, *pi_end, *cur_pi;
+
   if (!new_block)
     return NULL;
   *m_blk_hook= new_block;
   m_blk_hook= (void**)new_block;
-  item *result= (item *)(((char *)new_block) + PH_DATA_OFFSET);
-  item *pi_end= ptr_add(result, m_points_per_blk - 1);
-  item *cur_pi= ptr_add(result, 1);
+  result= (item *)(((char *)new_block) + PH_DATA_OFFSET);
+  pi_end= ptr_add(result, m_points_per_blk - 1);
+  cur_pi= ptr_add(result, 1);
   m_free= cur_pi;
   while (cur_pi<pi_end)
     cur_pi= cur_pi->next= ptr_add(cur_pi, 1);
@@ -51,9 +53,10 @@ gcalc_dyn_list::item *gcalc_dyn_list::al
 
 static void free_blk_list(void *list)
 {
+  void *next_blk;
   while (list)
   {
-    void *next_blk= *((void **)list);
+    next_blk= *((void **)list);
     my_free(list, MYF(0));
     list= next_blk;
   }
@@ -66,6 +69,7 @@ void gcalc_dyn_list::cleanup()
   free_blk_list(m_first_blk);
   m_first_blk= NULL;
   m_blk_hook= &m_first_blk;
+  m_free= NULL;
 }
 
 
@@ -77,11 +81,18 @@ gcalc_dyn_list::~gcalc_dyn_list()
 
 void gcalc_dyn_list::reset()
 {
+  item *pi_end, *cur_pi;
   *m_blk_hook= NULL;
   if (m_first_blk)
   {
     free_blk_list(*((void **)m_first_blk));
     m_blk_hook= (void**)m_first_blk;
+    cur_pi= (item *)(((char *)m_first_blk) + PH_DATA_OFFSET);
+    pi_end= ptr_add(cur_pi, m_points_per_blk);
+    m_free= cur_pi;
+    while (cur_pi<pi_end)
+      cur_pi= cur_pi->next= ptr_add(cur_pi, 1);
+    cur_pi->next= NULL;
   }
 }
 
@@ -159,7 +170,7 @@ gcalc_scan_iterator::gcalc_scan_iterator
   gcalc_dyn_list(blk_size,
 	         (sizeof(point) > sizeof(intersection)) ?
 	          sizeof(point) : sizeof(intersection)),
-  m_slice0(NULL)
+  m_slice0(NULL), m_slice1(NULL)
 {}
 		  
 gcalc_scan_iterator::point
@@ -181,14 +192,11 @@ gcalc_scan_iterator::point
 void gcalc_scan_iterator::init(gcalc_heap *points)
 {
   DBUG_ASSERT(points->ready());
+  DBUG_ASSERT(!m_slice0 && !m_slice1);
 
   if (!(m_cur_pi= points->get_first()))
     return;
   m_cur_thread= 0;
-  if (m_slice0)
-    free_list(m_slice0);
-  m_slice0= NULL;
-  m_slice1= NULL;
   m_sav_slice= NULL;
   m_intersections= NULL;
   m_cur_intersection= NULL;
@@ -197,6 +205,15 @@ void gcalc_scan_iterator::init(gcalc_hea
   m_bottom_points_count= 0;
 }
 
+void gcalc_scan_iterator::reset()
+{
+  if (m_slice0)
+    free_list(m_slice0);
+  if (m_slice1)
+    free_list(m_slice1);
+  m_slice0= m_slice1= NULL;
+  gcalc_dyn_list::reset();
+}
 
 static bool slice_first_equal_x(const gcalc_scan_iterator::point *p0,
 				const gcalc_scan_iterator::point *p1)
diff -Nrup a/sql/gcalc_slicescan.h b/sql/gcalc_slicescan.h
--- a/sql/gcalc_slicescan.h	2007-05-30 13:35:16 +05:00
+++ b/sql/gcalc_slicescan.h	2007-11-22 20:17:14 +04:00
@@ -245,6 +245,7 @@ public:
   gcalc_scan_iterator(size_t blk_size= 8192);
 
   void init(gcalc_heap *points); /* Iterator can be reused */
+  void reset();
   int step()
   {
     DBUG_ASSERT(more_points());
Thread
bk commit into 5.1 tree (holyfoot:1.2594)holyfoot22 Nov