1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

MDEV-31992 Automatic conversion from LEX_STRING to LEX_CSTRING

- Adding automatic conversion operator from LEX_STRING to LEX_CSTRING
  Now a LEX_STRING can be passed directly to any function expecting
  a LEX_CSTRING parameter passed by value or by reference.
- Removing a number of duplicate methods accepting LEX_STRING.
  Now the code used the LEX_CSTRING version.
This commit is contained in:
Alexander Barkov
2023-08-23 15:30:06 +04:00
parent 9b0b314b17
commit 8951f7d940
15 changed files with 87 additions and 72 deletions

View File

@@ -301,18 +301,22 @@ void my_sha512_input(void *context, const unsigned char *buf, size_t len);
void my_sha512_result(void *context, unsigned char *digest);
}
extern "C" {
struct st_mysql_lex_string
{
char *str;
size_t length;
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
struct st_mysql_const_lex_string
{
const char *str;
size_t length;
};
typedef struct st_mysql_const_lex_string MYSQL_CONST_LEX_STRING;
struct st_mysql_lex_string
{
char *str;
size_t length;
operator struct st_mysql_const_lex_string() const
{
return {str, length};
}
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(const THD*, size_t);
void *(*thd_calloc_func)(const THD*, size_t);