diff options
author | gluh@eagle.(none) <> | 2007-10-10 14:31:19 +0500 |
---|---|---|
committer | gluh@eagle.(none) <> | 2007-10-10 14:31:19 +0500 |
commit | 20ec6605d349c3cfa5c062a9818612616bbe3baa (patch) | |
tree | 239a3c07a2fecf0daa2794f4fdb2f82d1989e1b5 /myisam/rt_index.c | |
parent | 82767a0a45dd2a8c356bd9a5c8e8971dd15d4b05 (diff) | |
parent | a5e7b726c1840190d5e90854d2a4838fad68729f (diff) | |
download | mariadb-git-20ec6605d349c3cfa5c062a9818612616bbe3baa.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; } |