diff options
author | Monty <monty@mariadb.org> | 2020-07-16 16:30:06 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-07-23 10:54:32 +0300 |
commit | 61c15ebe323d4d6f02fab86c405b2613e5784961 (patch) | |
tree | 1b8eccd555f01f8819594bbbc373aba55a2c4694 /sql/wsrep_schema.cc | |
parent | 26824581281fcb2b2251585d8081de38d561ca93 (diff) | |
download | mariadb-git-61c15ebe323d4d6f02fab86c405b2613e5784961.tar.gz |
Remove String::lex_string() and String::lex_cstring()
- Better to use 'String *' directly.
- Added String::get_value(LEX_STRING*) for the few cases where we want to
convert a String to LEX_CSTRING.
Other things:
- Use StringBuffer for some functions to avoid mallocs
Diffstat (limited to 'sql/wsrep_schema.cc')
-rw-r--r-- | sql/wsrep_schema.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 80bc53b1790..7a3519d51f3 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -492,12 +492,11 @@ static int scan(TABLE* table, uint field, INTTYPE& val) static int scan(TABLE* table, uint field, char* strbuf, uint strbuf_len) { - String str; - (void)table->field[field]->val_str(&str); - LEX_CSTRING tmp= str.lex_cstring(); - uint len = tmp.length; - strncpy(strbuf, tmp.str, std::min(len, strbuf_len)); - strbuf[strbuf_len - 1]= '\0'; + uint len; + StringBuffer<STRING_BUFFER_USUAL_SIZE> str; + (void) table->field[field]->val_str(&str); + len= str.length(); + strmake(strbuf, str.ptr(), MY_MIN(len, strbuf_len-1)); return 0; } |