|
In order to implement MDEV-31606 and MDEV-27490 easier let's change a few LEX methods as follows:
- sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name);
|
- sp_name *make_sp_name(THD *thd, const LEX_CSTRING *name1,
|
- const LEX_CSTRING *name2);
|
- sp_name *make_sp_name_package_routine(THD *thd, const LEX_CSTRING *name);
|
+ sp_name *make_sp_name(THD *thd, const Lex_ident_sys_st &name);
|
+ sp_name *make_sp_name(THD *thd, const Lex_ident_sys_st &name1,
|
+ const Lex_ident_sys_st &name2);
|
+ sp_name *make_sp_name_package_routine(THD *thd,
|
+ const Lex_ident_sys_st &name);
|
Changing LEX_CSTRING to Lex_ident_sys_st makes the code inside these methods clear, because Lex_ident_sys_st additionally guarantees that the value comes from the "ident" rule from sql_yacc.yy, so:
- Its LEX_CSTRING::str is not NULL (sql_yacc.yy would abort otherwise)
- Its LEX_CSTRING::str is 0-terminated
- Its a valid utf8 string
- The string pointed by LEX_CSTRING::str was created on THD::mem_root
Also, let's change "pass by pointer" to "pass by reference", as these parameters can never be NULL - they are Bison stack variables.
|