Methods to copy a string value on memory root, but also allocate on memory root LEX_CSTRING itself and return a pointer to it. */
| 1456 | and return a pointer to it. |
| 1457 | */ |
| 1458 | LEX_CSTRING *make_clex_string(const char* str, size_t length) const |
| 1459 | { |
| 1460 | LEX_CSTRING *lex_str; |
| 1461 | char *tmp; |
| 1462 | if (unlikely(!(lex_str= (LEX_CSTRING *)alloc_root(mem_root, |
| 1463 | sizeof(LEX_CSTRING) + |
| 1464 | length+1)))) |
| 1465 | return 0; |
| 1466 | tmp= (char*) (lex_str+1); |
| 1467 | lex_str->str= tmp; |
| 1468 | memcpy(tmp, str, length); |
| 1469 | tmp[length]= 0; |
| 1470 | lex_str->length= length; |
| 1471 | return lex_str; |
| 1472 | } |
| 1473 | LEX_CSTRING *make_clex_string(const LEX_CSTRING from) const |
| 1474 | { |
| 1475 | return make_clex_string(from.str, from.length); |
no test coverage detected