diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-02-14 02:26:27 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-02-14 02:26:27 +0400 |
commit | f05d5c844f7e7cead2b9aa054cf8ad2bcc7daf4b (patch) | |
tree | c116b71575b9f3aa209b66a7aff768d2fe647158 | |
parent | 9a3a0d7d4062982d0977b9268fd599d7b0745c2d (diff) | |
download | mariadb-git-f05d5c844f7e7cead2b9aa054cf8ad2bcc7daf4b.tar.gz |
a little optimization in yylex
(case MY_LEX_USER_VARIABLE_DELIMITER for multichar strings)
and my_mbcharlen
include/m_ctype.h:
a trivial optimization of my_mbcharlen (case !USE_MB)
sql/sql_lex.cc:
a little optimization in yylex
(case MY_LEX_USER_VARIABLE_DELIMITER for multichar strings)
-rw-r--r-- | include/m_ctype.h | 4 | ||||
-rw-r--r-- | sql/sql_lex.cc | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index 88c3418fc0d..9c843382fc7 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -391,7 +391,11 @@ extern my_bool my_parse_charset_xml(const char *bug, uint len, #define use_mb(s) ((s)->cset->ismbchar != NULL) #define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b))) +#ifdef USE_MB #define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a))) +#else +#define my_mbcharlen(s, a) 1 +#endif #define my_caseup(s, a, l) ((s)->cset->caseup((s), (a), (l))) #define my_casedn(s, a, l) ((s)->cset->casedn((s), (a), (l))) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index bd7d0a31546..023415a6794 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -694,10 +694,9 @@ int yylex(void *arg, void *yythd) char quote_char= c; // Used char lex->tok_start=lex->ptr; // Skip first ` while ((c=yyGet())) - { -#ifdef USE_MB - if (my_mbcharlen(cs, c) == 1) -#endif + { + int l; + if ((l= my_mbcharlen(cs, c)) == 1) { if (c == (uchar) NAMES_SEP_CHAR) break; /* Old .frm format can't handle this char */ @@ -711,15 +710,12 @@ int yylex(void *arg, void *yythd) } } #ifdef USE_MB - else + else if (l > 1) { - int l; - if ((l = my_ismbchar(cs, - (const char *)lex->ptr-1, - (const char *)lex->end_of_query)) == 0) - break; lex->ptr += l-1; } + else + break; #endif } if (double_quotes) |