diff options
author | unknown <monty@mysql.com> | 2005-06-01 16:35:09 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-06-01 16:35:09 +0300 |
commit | 906b210a4a51a91416d553cb744bc9c22d0bd942 (patch) | |
tree | ad666c13b9844b04a96005aa6c422f8542efce7c /strings | |
parent | 87805b682d483611a6685afcc103f83944734c12 (diff) | |
download | mariadb-git-906b210a4a51a91416d553cb744bc9c22d0bd942.tar.gz |
Code cleanups during code reviews
Ensure we get error if INSERT IGNORE ... SELECT fails
Fixed wrong key_part->key_length usage in index_merge
client/mysql.cc:
Code cleanups & simply optimizations
mysql-test/r/information_schema.result:
Safety
mysql-test/t/information_schema.test:
Safety
sql/ha_ndbcluster.cc:
Code cleanups
sql/item.cc:
Code cleanups
sql/item_subselect.cc:
Code cleanups
sql/item_sum.cc:
Code cleanups
sql/opt_range.cc:
Made get_index_only_read_time() static (instad of inline) to increase portability (function was not declared before use)
Simple optimization
Fixed wrong key_part->key_length usage in index_merge
Removed not used variable n_used_covered
Indentation fixes & comment cleanups
sql/parse_file.cc:
Code cleanups
sql/sql_base.cc:
Code cleanups
sql/sql_bitmap.h:
Added missing return
sql/sql_insert.cc:
Ensure we get error if INSERT IGNORE ... SELECT fails
sql/sql_select.cc:
Code cleanups
sql/sql_show.cc:
Safety fix if a LOT of errors are ignored
sql/sql_update.cc:
Code cleanups
sql/table.cc:
Code cleanups
sql/table.h:
Code cleanups
sql/uniques.cc:
Code cleanups
strings/decimal.c:
Simple optimization
Code cleanups
Diffstat (limited to 'strings')
-rw-r--r-- | strings/decimal.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 1e62333ee66..787d00dcb46 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1549,15 +1549,19 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, } else { - while (unlikely(*buf1 == 0) && buf1 >= to->buf) - buf1--; - if (buf1 < to->buf) + for (;;) { - decimal_make_zero(to); - return E_DEC_OK; + if (likely(*buf1)) + break; + if (buf1-- == to->buf) + { + decimal_make_zero(to); + return E_DEC_OK; + } } } - if (scale<0) scale=0; + if (scale<0) + scale=0; done: to->frac=scale; @@ -1727,11 +1731,14 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2) buf1++, buf2++; if (buf1 <= end1) + { if (buf2 <= end2) carry= *buf2 > *buf1; else carry= 0; + } else + { if (buf2 <= end2) carry=1; else /* short-circuit everything: from1 == from2 */ @@ -1741,6 +1748,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) decimal_make_zero(to); return E_DEC_OK; } + } } if (to == 0) /* decimal_cmp() */ @@ -1937,10 +1945,18 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to) { dec1 *buf= to->buf; dec1 *end= to->buf + intg0 + frac0; - for (; (buf<end) && !*buf; buf++); - if (buf == end) - /* So we got decimal zero */ - decimal_make_zero(to); + DBUG_ASSERT(buf != end); + for (;;) + { + if (*buf) + break; + if (++buf == end) + { + /* We got decimal zero */ + decimal_make_zero(to); + break; + } + } } return error; } |