From 1329f063c052e70fa71c7aaacb08e49357d108f5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Feb 2005 08:35:15 +0400 Subject: [PATCH] field.cc: optimize test_if_minus() when not UCS2 support is compiled. sql/field.cc: optimize test_if_minus() when not UCS2 support is compiled. --- sql/field.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index fa0e202d513..34c5d572526 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1776,13 +1776,23 @@ void Field_medium::sql_type(String &res) const ** long int ****************************************************************************/ - +/* + A helper function to check whether the next character + in the string "s" is MINUS SIGN. +*/ +#ifdef HAVE_CHARSET_ucs2 static bool test_if_minus(CHARSET_INFO *cs, const char *s, const char *e) { my_wc_t wc; return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-'; } +#else +/* + If not UCS2 support is compiled then it is easier +*/ +#define test_if_minus(cs, s, e) (*s == '-') +#endif int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)