diff options
author | gluh@eagle.(none) <> | 2007-10-23 18:51:43 +0500 |
---|---|---|
committer | gluh@eagle.(none) <> | 2007-10-23 18:51:43 +0500 |
commit | 237383f0fecd267d702b92713d49b0f9b2c78746 (patch) | |
tree | d36465f86e78c442a44942849b7280eab8d10bf8 /myisam/rt_index.c | |
parent | 9732efe7f8970626840cf64628ab75f83eee5523 (diff) | |
parent | d0f53297f6acffecb75845fdc03df35c6956efbc (diff) | |
download | mariadb-git-237383f0fecd267d702b92713d49b0f9b2c78746.tar.gz |
Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt
Diffstat (limited to 'myisam/rt_index.c')
-rw-r--r-- | myisam/rt_index.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/myisam/rt_index.c b/myisam/rt_index.c index cf144839dd1..8ecb3688ad5 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -483,15 +483,16 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, uchar *page_buf, uint nod_flag) { double increase; - double best_incr = DBL_MAX; + double best_incr; double area; double best_area; - uchar *best_key; + uchar *best_key= NULL; uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag); uchar *last = rt_PAGE_END(page_buf); LINT_INIT(best_area); LINT_INIT(best_key); + LINT_INIT(best_incr); for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag)) { @@ -500,22 +501,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, &area)) == -1.0) return NULL; /* The following should be safe, even if we compare doubles */ - if (increase < best_incr) + if (!best_key || increase < best_incr || + ((increase == best_incr) && (area < best_area))) { best_key = k; best_area = area; best_incr = increase; } - else - { - /* The following should be safe, even if we compare doubles */ - if ((increase == best_incr) && (area < best_area)) - { - best_key = k; - best_area = area; - best_incr = increase; - } - } } return best_key; } |