cleanup: CREATE_TYPELIB_FOR() helper

This commit is contained in:
Sergei Golubchik 2024-08-30 11:04:14 +02:00
parent 9fa31c1bd9
commit d046aca0c7
39 changed files with 317 additions and 486 deletions

View file

@ -111,8 +111,7 @@ static const char *command_names[]= {
NullS NullS
}; };
static TYPELIB command_typelib= static TYPELIB command_typelib= CREATE_TYPELIB_FOR(command_names);
{ array_elements(command_names)-1,"commands", command_names, NULL};
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {

View file

@ -116,9 +116,7 @@ static bool one_database=0, one_table=0, to_last_remote_log= 0, disable_log_bin=
static bool opt_hexdump= 0, opt_version= 0; static bool opt_hexdump= 0, opt_version= 0;
const char *base64_output_mode_names[]= const char *base64_output_mode_names[]=
{"NEVER", "AUTO", "UNSPEC", "DECODE-ROWS", NullS}; {"NEVER", "AUTO", "UNSPEC", "DECODE-ROWS", NullS};
TYPELIB base64_output_mode_typelib= TYPELIB base64_output_mode_typelib=CREATE_TYPELIB_FOR(base64_output_mode_names);
{ array_elements(base64_output_mode_names) - 1, "",
base64_output_mode_names, NULL };
static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC; static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
static char *opt_base64_output_mode_str= NullS; static char *opt_base64_output_mode_str= NullS;
static char* database= 0; static char* database= 0;

View file

@ -66,8 +66,7 @@ const char *operation_name[]=
typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_UPGRADE, DO_VIEWS_FROM_MYSQL } enum_do_views; typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_UPGRADE, DO_VIEWS_FROM_MYSQL } enum_do_views;
const char *do_views_opts[]= {"NO", "YES", "UPGRADE", "UPGRADE_FROM_MYSQL", const char *do_views_opts[]= {"NO", "YES", "UPGRADE", "UPGRADE_FROM_MYSQL",
NullS}; NullS};
TYPELIB do_views_typelib= { array_elements(do_views_opts) - 1, "", TYPELIB do_views_typelib= CREATE_TYPELIB_FOR(do_views_opts);
do_views_opts, NULL };
static ulong opt_do_views= DO_VIEWS_NO; static ulong opt_do_views= DO_VIEWS_NO;
static struct my_option my_long_options[] = static struct my_option my_long_options[] =

View file

@ -140,11 +140,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
#define OPT_SYSTEM_TIMEZONES 64 #define OPT_SYSTEM_TIMEZONES 64
static const char *opt_system_type_values[]= static const char *opt_system_type_values[]=
{"all", "users", "plugins", "udfs", "servers", "stats", "timezones"}; {"all", "users", "plugins", "udfs", "servers", "stats", "timezones"};
static TYPELIB opt_system_types= static TYPELIB opt_system_types=CREATE_TYPELIB_FOR(opt_system_type_values);
{
array_elements(opt_system_type_values), "system dump options",
opt_system_type_values, NULL
};
static ulonglong opt_system= 0ULL; static ulonglong opt_system= 0ULL;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0, static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0,
select_field_names_inited= 0; select_field_names_inited= 0;
@ -250,8 +246,7 @@ const char *compatible_mode_names[]=
(1U<<6) | /* MAXDB */\ (1U<<6) | /* MAXDB */\
(1U<<10) /* ANSI */\ (1U<<10) /* ANSI */\
) )
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1, TYPELIB compatible_mode_typelib= CREATE_TYPELIB_FOR(compatible_mode_names);
"", compatible_mode_names, NULL};
#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED" #define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"

View file

@ -594,8 +594,7 @@ struct st_command
enum enum_commands type; enum enum_commands type;
}; };
TYPELIB command_typelib= {array_elements(command_names),"", TYPELIB command_typelib= CREATE_TYPELIB_FOR(command_names);
command_names, 0};
DYNAMIC_STRING ds_res; DYNAMIC_STRING ds_res;
/* Points to ds_warning in run_query, so it can be freed */ /* Points to ds_warning in run_query, so it can be freed */

View file

@ -176,8 +176,7 @@ static enum {MODE_GET, MODE_PUT, MODE_DELETE} opt_mode;
static char **file_list = NULL; static char **file_list = NULL;
static int file_list_size = 0; static int file_list_size = 0;
TYPELIB storage_typelib = TYPELIB storage_typelib = CREATE_TYPELIB_FOR(storage_names);
{array_elements(storage_names)-1, "", storage_names, NULL};
enum { enum {
OPT_STORAGE = 256, OPT_STORAGE = 256,

View file

@ -385,8 +385,7 @@ static ulong innodb_flush_method;
static const char *binlog_info_values[] = {"off", "lockless", "on", "auto", static const char *binlog_info_values[] = {"off", "lockless", "on", "auto",
NullS}; NullS};
static TYPELIB binlog_info_typelib = {array_elements(binlog_info_values)-1, "", static TYPELIB binlog_info_typelib = CREATE_TYPELIB_FOR(binlog_info_values);
binlog_info_values, NULL};
ulong opt_binlog_info; ulong opt_binlog_info;
char *opt_incremental_history_name; char *opt_incremental_history_name;
@ -402,8 +401,7 @@ char *opt_log_bin;
const char *query_type_names[] = { "ALL", "UPDATE", "SELECT", NullS}; const char *query_type_names[] = { "ALL", "UPDATE", "SELECT", NullS};
TYPELIB query_type_typelib= {array_elements(query_type_names) - 1, "", TYPELIB query_type_typelib= CREATE_TYPELIB_FOR(query_type_names);
query_type_names, NULL};
ulong opt_lock_wait_query_type; ulong opt_lock_wait_query_type;
ulong opt_kill_long_query_type; ulong opt_kill_long_query_type;

View file

@ -27,6 +27,8 @@ typedef struct st_typelib { /* Different types saved here */
unsigned int *type_lengths; unsigned int *type_lengths;
} TYPELIB; } TYPELIB;
#define CREATE_TYPELIB_FOR(X) { (unsigned int)(sizeof(X)/sizeof(X[0])) - 1, "", X, NULL }
extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib, extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib,
int *error_position); int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib, extern int find_type_with_warning(const char *x, TYPELIB *typelib,

View file

@ -130,5 +130,4 @@ my_bool my_disable_copystat_in_redel=0;
const char *sql_protocol_names_lib[] = const char *sql_protocol_names_lib[] =
{ "TCP", "SOCKET", "PIPE", NullS }; { "TCP", "SOCKET", "PIPE", NullS };
TYPELIB sql_protocol_typelib ={ array_elements(sql_protocol_names_lib) - 1, "", TYPELIB sql_protocol_typelib= CREATE_TYPELIB_FOR(sql_protocol_names_lib);
sql_protocol_names_lib, NULL };

View file

@ -265,8 +265,7 @@ TYPELIB *copy_typelib(MEM_ROOT *root, const TYPELIB *from)
static const char *on_off_default_names[]= { "off","on","default", 0}; static const char *on_off_default_names[]= { "off","on","default", 0};
static TYPELIB on_off_default_typelib= {array_elements(on_off_default_names)-1, static TYPELIB on_off_default_typelib= CREATE_TYPELIB_FOR(on_off_default_names);
"", on_off_default_names, 0};
/** /**
Parse a TYPELIB name from the buffer Parse a TYPELIB name from the buffer

View file

@ -109,12 +109,7 @@ static const char* mech_names[] = {
"", "",
NULL NULL
}; };
static TYPELIB mech_name_typelib = { static TYPELIB mech_name_typelib = CREATE_TYPELIB_FOR(mech_names);
3,
"mech_name_typelib",
mech_names,
NULL
};
static MYSQL_SYSVAR_ENUM(mech_name, srv_mech, static MYSQL_SYSVAR_ENUM(mech_name, srv_mech,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
"GSSAPI mechanism", "GSSAPI mechanism",

View file

@ -673,11 +673,7 @@ struct st_mariadb_encryption aws_key_management_plugin= {
}; };
static TYPELIB key_spec_typelib = static TYPELIB key_spec_typelib = CREATE_TYPELIB_FOR(key_spec_names);
{
array_elements(key_spec_names) - 1, "",
key_spec_names, NULL
};
const char *log_level_names[] = const char *log_level_names[] =
{ {
@ -691,11 +687,7 @@ const char *log_level_names[] =
0 0
}; };
static TYPELIB log_level_typelib = static TYPELIB log_level_typelib = CREATE_TYPELIB_FOR(log_level_names);
{
array_elements(log_level_names) - 1, "",
log_level_names, NULL
};
static MYSQL_SYSVAR_STR(master_key_id, master_key_id, static MYSQL_SYSVAR_STR(master_key_id, master_key_id,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,

View file

@ -32,12 +32,7 @@ static const char *encryption_algorithm_names[]=
0 0
}; };
static TYPELIB encryption_algorithm_typelib= static TYPELIB encryption_algorithm_typelib=CREATE_TYPELIB_FOR(encryption_algorithm_names);
{
array_elements(encryption_algorithm_names)-1,"",
encryption_algorithm_names, NULL
};
static MYSQL_SYSVAR_STR(filename, filename, static MYSQL_SYSVAR_STR(filename, filename,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,

View file

@ -45,8 +45,7 @@ enum session_stat
}; };
static const char *session_stat_names[]= {"GLOBAL", "ON", "OFF", NullS}; static const char *session_stat_names[]= {"GLOBAL", "ON", "OFF", NullS};
static TYPELIB session_stat_typelib= { array_elements(session_stat_names) - 1, static TYPELIB session_stat_typelib= CREATE_TYPELIB_FOR(session_stat_names);
"", session_stat_names, NULL};
static MYSQL_SYSVAR_ULONG(range_base, opt_query_response_time_range_base, static MYSQL_SYSVAR_ULONG(range_base, opt_query_response_time_range_base,

View file

@ -393,10 +393,7 @@ static const char *event_names[]=
"CONNECT", "QUERY", "TABLE", "QUERY_DDL", "QUERY_DML", "QUERY_DCL", "CONNECT", "QUERY", "TABLE", "QUERY_DDL", "QUERY_DML", "QUERY_DCL",
"QUERY_DML_NO_SELECT", NULL "QUERY_DML_NO_SELECT", NULL
}; };
static TYPELIB events_typelib= static TYPELIB events_typelib= CREATE_TYPELIB_FOR(event_names);
{
array_elements(event_names) - 1, "", event_names, NULL
};
static MYSQL_SYSVAR_SET(events, events, PLUGIN_VAR_RQCMDARG, static MYSQL_SYSVAR_SET(events, events, PLUGIN_VAR_RQCMDARG,
"Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE," "Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE,"
" QUERY_DDL, QUERY_DML, QUERY_DML_NO_SELECT, QUERY_DCL", " QUERY_DDL, QUERY_DML, QUERY_DML_NO_SELECT, QUERY_DCL",
@ -415,11 +412,7 @@ static const char *output_type_names[]= {
"syslog", "syslog",
#endif #endif
"file", 0 }; "file", 0 };
static TYPELIB output_typelib= static TYPELIB output_typelib=CREATE_TYPELIB_FOR(output_type_names);
{
array_elements(output_type_names) - 1, "output_typelib",
output_type_names, NULL
};
static MYSQL_SYSVAR_ENUM(output_type, output_type, PLUGIN_VAR_RQCMDARG, static MYSQL_SYSVAR_ENUM(output_type, output_type, PLUGIN_VAR_RQCMDARG,
out_type_desc, out_type_desc,
0, update_output_type, OUTPUT_FILE, 0, update_output_type, OUTPUT_FILE,
@ -487,11 +480,7 @@ static unsigned int syslog_facility_codes[]=
LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7,
}; };
#endif #endif
static TYPELIB syslog_facility_typelib= static TYPELIB syslog_facility_typelib=CREATE_TYPELIB_FOR(syslog_facility_names);
{
array_elements(syslog_facility_names) - 1, "syslog_facility_typelib",
syslog_facility_names, NULL
};
static MYSQL_SYSVAR_ENUM(syslog_facility, syslog_facility, PLUGIN_VAR_RQCMDARG, static MYSQL_SYSVAR_ENUM(syslog_facility, syslog_facility, PLUGIN_VAR_RQCMDARG,
"The 'facility' parameter of the SYSLOG record." "The 'facility' parameter of the SYSLOG record."
" The default is LOG_USER", 0, update_syslog_facility, 0/*LOG_USER*/, " The default is LOG_USER", 0, update_syslog_facility, 0/*LOG_USER*/,
@ -512,11 +501,7 @@ static unsigned int syslog_priority_codes[]=
}; };
#endif #endif
static TYPELIB syslog_priority_typelib= static TYPELIB syslog_priority_typelib=CREATE_TYPELIB_FOR(syslog_priority_names);
{
array_elements(syslog_priority_names) - 1, "syslog_priority_typelib",
syslog_priority_names, NULL
};
static MYSQL_SYSVAR_ENUM(syslog_priority, syslog_priority, PLUGIN_VAR_RQCMDARG, static MYSQL_SYSVAR_ENUM(syslog_priority, syslog_priority, PLUGIN_VAR_RQCMDARG,
"The 'priority' parameter of the SYSLOG record." "The 'priority' parameter of the SYSLOG record."
" The default is LOG_INFO", 0, update_syslog_priority, 6/*LOG_INFO*/, " The default is LOG_INFO", 0, update_syslog_priority, 6/*LOG_INFO*/,

View file

@ -811,8 +811,7 @@ static char *opt_strdup(const char *from, myf my_flags)
return my_strdup(key_memory_mysql_options, from, my_flags); return my_strdup(key_memory_mysql_options, from, my_flags);
} }
static TYPELIB option_types={array_elements(default_options)-1, static TYPELIB option_types=CREATE_TYPELIB_FOR(default_options);
"options",default_options, NULL};
static int add_init_command(struct st_mysql_options *options, const char *cmd) static int add_init_command(struct st_mysql_options *options, const char *cmd)
{ {

View file

@ -45,8 +45,7 @@
static const char *stage_names[]= static const char *stage_names[]=
{"START", "FLUSH", "BLOCK_DDL", "BLOCK_COMMIT", "END", 0}; {"START", "FLUSH", "BLOCK_DDL", "BLOCK_COMMIT", "END", 0};
TYPELIB backup_stage_names= TYPELIB backup_stage_names= CREATE_TYPELIB_FOR(stage_names);
{ array_elements(stage_names)-1, "", stage_names, 0 };
static MDL_ticket *backup_flush_ticket; static MDL_ticket *backup_flush_ticket;
static File volatile backup_log= -1; static File volatile backup_log= -1;

View file

@ -152,8 +152,7 @@ const LEX_CSTRING ha_row_type[]=
const char *tx_isolation_names[]= const char *tx_isolation_names[]=
{ "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ", "SERIALIZABLE", { "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ", "SERIALIZABLE",
NullS}; NullS};
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", TYPELIB tx_isolation_typelib= CREATE_TYPELIB_FOR(tx_isolation_names);
tx_isolation_names, NULL};
static TYPELIB known_extensions= {0,"known_exts", NULL, NULL}; static TYPELIB known_extensions= {0,"known_exts", NULL, NULL};
uint known_extensions_id= 0; uint known_extensions_id= 0;

View file

@ -326,7 +326,8 @@ const char *block_encryption_mode_values[]= {
"aes-128-cbc", "aes-192-cbc", "aes-256-cbc", "aes-128-cbc", "aes-192-cbc", "aes-256-cbc",
"aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr",
NullS }; NullS };
TYPELIB block_encryption_mode_typelib= {9, 0, block_encryption_mode_values, 0}; TYPELIB block_encryption_mode_typelib=
CREATE_TYPELIB_FOR(block_encryption_mode_values);
static inline uint block_encryption_mode_to_key_length(ulong bem) static inline uint block_encryption_mode_to_key_length(ulong bem)
{ return (bem % 3 + 2) * 64; } { return (bem % 3 + 2) * 64; }
static inline my_aes_mode block_encryption_mode_to_aes_mode(ulong bem) static inline my_aes_mode block_encryption_mode_to_aes_mode(ulong bem)
@ -671,10 +672,7 @@ err:
const char *histogram_types[] = const char *histogram_types[] =
{"SINGLE_PREC_HB", "DOUBLE_PREC_HB", "JSON_HB", 0}; {"SINGLE_PREC_HB", "DOUBLE_PREC_HB", "JSON_HB", 0};
static TYPELIB histogram_types_typelib= static TYPELIB histogram_types_typelib= CREATE_TYPELIB_FOR(histogram_types);
{ array_elements(histogram_types),
"histogram_types",
histogram_types, NULL};
const char *representation_by_type[]= {"%.3f", "%.5f"}; const char *representation_by_type[]= {"%.3f", "%.5f"};
String *Item_func_decode_histogram::val_str(String *str) String *Item_func_decode_histogram::val_str(String *str)

View file

@ -80,13 +80,7 @@ unsigned int binlog_checksum_type_length[]= {
0 0
}; };
TYPELIB binlog_checksum_typelib= TYPELIB binlog_checksum_typelib= CREATE_TYPELIB_FOR(binlog_checksum_type_names);
{
array_elements(binlog_checksum_type_names) - 1, "",
binlog_checksum_type_names,
binlog_checksum_type_length
};
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"") #define FLAGSTR(V,F) ((V)&(F)?#F" ":"")

View file

@ -55,8 +55,7 @@ ulong rpl_status=RPL_NULL;
mysql_mutex_t LOCK_rpl_status; mysql_mutex_t LOCK_rpl_status;
const char *rpl_role_type[] = {"MASTER","SLAVE",NullS}; const char *rpl_role_type[] = {"MASTER","SLAVE",NullS};
TYPELIB rpl_role_typelib = {array_elements(rpl_role_type)-1,"", TYPELIB rpl_role_typelib = CREATE_TYPELIB_FOR(rpl_role_type);
rpl_role_type, NULL};
const char* rpl_status_type[]= const char* rpl_status_type[]=
{ {

View file

@ -52,8 +52,7 @@
#define MAX_DROP_TABLE_Q_LEN 1024 #define MAX_DROP_TABLE_Q_LEN 1024
const char *del_exts[]= {".BAK", ".opt", NullS}; const char *del_exts[]= {".BAK", ".opt", NullS};
static TYPELIB deletable_extensions= static TYPELIB deletable_extensions= CREATE_TYPELIB_FOR(del_exts);
{array_elements(del_exts)-1,"del_exts", del_exts, NULL};
static bool find_db_tables_and_rm_known_files(THD *, MY_DIR *, static bool find_db_tables_and_rm_known_files(THD *, MY_DIR *,
const Lex_ident_db_normalized &db, const Lex_ident_db_normalized &db,

File diff suppressed because it is too large Load diff

View file

@ -62,8 +62,7 @@ extern struct st_maria_plugin *mysql_mandatory_plugins[];
const char *global_plugin_typelib_names[]= const char *global_plugin_typelib_names[]=
{ "OFF", "ON", "FORCE", "FORCE_PLUS_PERMANENT", NULL }; { "OFF", "ON", "FORCE", "FORCE_PLUS_PERMANENT", NULL };
static TYPELIB global_plugin_typelib= static TYPELIB global_plugin_typelib=
{ array_elements(global_plugin_typelib_names)-1, CREATE_TYPELIB_FOR(global_plugin_typelib_names);
"", global_plugin_typelib_names, NULL };
static I_List<i_string> opt_plugin_load_list; static I_List<i_string> opt_plugin_load_list;
I_List<i_string> *opt_plugin_load_list_ptr= &opt_plugin_load_list; I_List<i_string> *opt_plugin_load_list_ptr= &opt_plugin_load_list;

View file

@ -140,10 +140,7 @@ LEX_CSTRING INDEX_clex_str= { STRING_WITH_LEN("INDEX") };
static const char *grant_names[]={ static const char *grant_names[]={
"select","insert","update","delete","create","drop","reload","shutdown", "select","insert","update","delete","create","drop","reload","shutdown",
"process","file","grant","references","index","alter"}; "process","file","grant","references","index","alter"};
static TYPELIB grant_types = CREATE_TYPELIB_FOR(grant_names);
static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
"grant_types",
grant_names, NULL};
#endif #endif
/* Match the values of enum ha_choice */ /* Match the values of enum ha_choice */

View file

@ -2521,12 +2521,8 @@ Sys_var_slave_parallel_mode::global_value_ptr(THD *thd,
static const char *slave_parallel_mode_names[] = { static const char *slave_parallel_mode_names[] = {
"none", "minimal", "conservative", "optimistic", "aggressive", NULL "none", "minimal", "conservative", "optimistic", "aggressive", NULL
}; };
export TYPELIB slave_parallel_mode_typelib = { export TYPELIB slave_parallel_mode_typelib =
array_elements(slave_parallel_mode_names)-1, CREATE_TYPELIB_FOR(slave_parallel_mode_names);
"",
slave_parallel_mode_names,
NULL
};
static Sys_var_on_access_global<Sys_var_slave_parallel_mode, static Sys_var_on_access_global<Sys_var_slave_parallel_mode,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_MODE> PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_PARALLEL_MODE>

View file

@ -105,7 +105,7 @@ extern const char *UNUSED_HELP;
static const char *bool_values[3]= {"OFF", "ON", 0}; static const char *bool_values[3]= {"OFF", "ON", 0};
TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 }; TYPELIB bool_typelib= CREATE_TYPELIB_FOR(bool_values);
template<class BASE, privilege_t GLOBAL_PRIV, privilege_t SESSION_PRIV> template<class BASE, privilege_t GLOBAL_PRIV, privilege_t SESSION_PRIV>

View file

@ -305,11 +305,7 @@ const char *xtrace_names[] =
"QUERY", "STMT", "HANDLER", "BLOCK", "MONGO", NullS "QUERY", "STMT", "HANDLER", "BLOCK", "MONGO", NullS
}; };
TYPELIB xtrace_typelib = TYPELIB xtrace_typelib = CREATE_TYPELIB_FOR(xtrace_names);
{
array_elements(xtrace_names) - 1, "xtrace_typelib",
xtrace_names, NULL
};
static MYSQL_THDVAR_SET( static MYSQL_THDVAR_SET(
xtrace, // name xtrace, // name
@ -343,11 +339,7 @@ const char *usetemp_names[]=
"NO", "AUTO", "YES", "FORCE", "TEST", NullS "NO", "AUTO", "YES", "FORCE", "TEST", NullS
}; };
TYPELIB usetemp_typelib= TYPELIB usetemp_typelib= CREATE_TYPELIB_FOR(usetemp_names);
{
array_elements(usetemp_names) - 1, "usetemp_typelib",
usetemp_names, NULL
};
static MYSQL_THDVAR_ENUM( static MYSQL_THDVAR_ENUM(
use_tempfile, // name use_tempfile, // name
@ -390,11 +382,7 @@ const char *xconv_names[]=
"NO", "YES", "FORCE", "SKIP", NullS "NO", "YES", "FORCE", "SKIP", NullS
}; };
TYPELIB xconv_typelib= TYPELIB xconv_typelib= CREATE_TYPELIB_FOR(xconv_names);
{
array_elements(xconv_names) - 1, "xconv_typelib",
xconv_names, NULL
};
static MYSQL_THDVAR_ENUM( static MYSQL_THDVAR_ENUM(
type_conv, // name type_conv, // name
@ -469,11 +457,7 @@ const char *language_names[]=
"default", "english", "french", NullS "default", "english", "french", NullS
}; };
TYPELIB language_typelib= TYPELIB language_typelib= CREATE_TYPELIB_FOR(language_names);
{
array_elements(language_names) - 1, "language_typelib",
language_names, NULL
};
static MYSQL_THDVAR_ENUM( static MYSQL_THDVAR_ENUM(
msg_lang, // name msg_lang, // name

View file

@ -1000,11 +1000,7 @@ const char *enum_var_names[]=
"e1", "e2", NullS "e1", "e2", NullS
}; };
TYPELIB enum_var_typelib= TYPELIB enum_var_typelib= CREATE_TYPELIB_FOR(enum_var_names);
{
array_elements(enum_var_names) - 1, "enum_var_typelib",
enum_var_names, NULL
};
static MYSQL_SYSVAR_ENUM( static MYSQL_SYSVAR_ENUM(
enum_var, // name enum_var, // name

View file

@ -310,12 +310,8 @@ static const char* innodb_stats_method_names[] = {
/** Used to define an enumerate type of the system variable innodb_stats_method. /** Used to define an enumerate type of the system variable innodb_stats_method.
This is the same as "myisam_stats_method_typelib" */ This is the same as "myisam_stats_method_typelib" */
static TYPELIB innodb_stats_method_typelib = { static TYPELIB innodb_stats_method_typelib =
array_elements(innodb_stats_method_names) - 1, CREATE_TYPELIB_FOR(innodb_stats_method_names);
"innodb_stats_method_typelib",
innodb_stats_method_names,
NULL
};
/** Possible values of the parameter innodb_checksum_algorithm */ /** Possible values of the parameter innodb_checksum_algorithm */
const char* innodb_checksum_algorithm_names[] = { const char* innodb_checksum_algorithm_names[] = {
@ -328,12 +324,8 @@ const char* innodb_checksum_algorithm_names[] = {
/** Used to define an enumerate type of the system variable /** Used to define an enumerate type of the system variable
innodb_checksum_algorithm. */ innodb_checksum_algorithm. */
TYPELIB innodb_checksum_algorithm_typelib = { TYPELIB innodb_checksum_algorithm_typelib =
array_elements(innodb_checksum_algorithm_names) - 1, CREATE_TYPELIB_FOR(innodb_checksum_algorithm_names);
"innodb_checksum_algorithm_typelib",
innodb_checksum_algorithm_names,
NULL
};
/** Possible values for system variable "innodb_default_row_format". */ /** Possible values for system variable "innodb_default_row_format". */
static const char* innodb_default_row_format_names[] = { static const char* innodb_default_row_format_names[] = {
@ -345,12 +337,8 @@ static const char* innodb_default_row_format_names[] = {
/** Used to define an enumerate type of the system variable /** Used to define an enumerate type of the system variable
innodb_default_row_format. */ innodb_default_row_format. */
static TYPELIB innodb_default_row_format_typelib = { static TYPELIB innodb_default_row_format_typelib =
array_elements(innodb_default_row_format_names) - 1, CREATE_TYPELIB_FOR(innodb_default_row_format_names);
"innodb_default_row_format_typelib",
innodb_default_row_format_names,
NULL
};
/** Names of allowed values of innodb_flush_method */ /** Names of allowed values of innodb_flush_method */
static const char* innodb_flush_method_names[] = { static const char* innodb_flush_method_names[] = {
@ -371,12 +359,8 @@ static const char* innodb_flush_method_names[] = {
static constexpr ulong innodb_flush_method_default = IF_WIN(6,4); static constexpr ulong innodb_flush_method_default = IF_WIN(6,4);
/** Enumeration of innodb_flush_method */ /** Enumeration of innodb_flush_method */
TYPELIB innodb_flush_method_typelib = { TYPELIB innodb_flush_method_typelib =
array_elements(innodb_flush_method_names) - 1, CREATE_TYPELIB_FOR(innodb_flush_method_names);
"innodb_flush_method_typelib",
innodb_flush_method_names,
NULL
};
/** Deprecated parameter */ /** Deprecated parameter */
static ulong innodb_flush_method; static ulong innodb_flush_method;
@ -386,12 +370,8 @@ static const char *innodb_doublewrite_names[]=
{"OFF", "ON", "fast", nullptr}; {"OFF", "ON", "fast", nullptr};
/** Enumeration of innodb_doublewrite */ /** Enumeration of innodb_doublewrite */
TYPELIB innodb_doublewrite_typelib= { TYPELIB innodb_doublewrite_typelib=
array_elements(innodb_doublewrite_names) - 1, CREATE_TYPELIB_FOR(innodb_doublewrite_names);
"innodb_doublewrite_typelib",
innodb_doublewrite_names,
nullptr
};
/** Names of allowed values of innodb_deadlock_report */ /** Names of allowed values of innodb_deadlock_report */
static const char *innodb_deadlock_report_names[]= { static const char *innodb_deadlock_report_names[]= {
@ -406,12 +386,8 @@ static_assert(Deadlock::REPORT_BASIC == 1, "compatibility");
static_assert(Deadlock::REPORT_FULL == 2, "compatibility"); static_assert(Deadlock::REPORT_FULL == 2, "compatibility");
/** Enumeration of innodb_deadlock_report */ /** Enumeration of innodb_deadlock_report */
static TYPELIB innodb_deadlock_report_typelib = { static TYPELIB innodb_deadlock_report_typelib =
array_elements(innodb_deadlock_report_names) - 1, CREATE_TYPELIB_FOR(innodb_deadlock_report_names);
"innodb_deadlock_report_typelib",
innodb_deadlock_report_names,
NULL
};
/** Allowed values of innodb_instant_alter_column_allowed */ /** Allowed values of innodb_instant_alter_column_allowed */
const char* innodb_instant_alter_column_allowed_names[] = { const char* innodb_instant_alter_column_allowed_names[] = {
@ -422,12 +398,8 @@ const char* innodb_instant_alter_column_allowed_names[] = {
}; };
/** Enumeration of innodb_instant_alter_column_allowed */ /** Enumeration of innodb_instant_alter_column_allowed */
static TYPELIB innodb_instant_alter_column_allowed_typelib = { static TYPELIB innodb_instant_alter_column_allowed_typelib =
array_elements(innodb_instant_alter_column_allowed_names) - 1, CREATE_TYPELIB_FOR(innodb_instant_alter_column_allowed_names);
"innodb_instant_alter_column_allowed_typelib",
innodb_instant_alter_column_allowed_names,
NULL
};
/** Retrieve the FTS Relevance Ranking result for doc with doc_id /** Retrieve the FTS Relevance Ranking result for doc with doc_id
of m_prebuilt->fts_doc_id of m_prebuilt->fts_doc_id
@ -19774,10 +19746,7 @@ static MYSQL_SYSVAR_BOOL(alter_copy_bulk, innodb_alter_copy_bulk,
const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 }; const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 };
static TYPELIB page_compression_algorithms_typelib= static TYPELIB page_compression_algorithms_typelib=
{ CREATE_TYPELIB_FOR(page_compression_algorithms);
array_elements(page_compression_algorithms) - 1, 0,
page_compression_algorithms, 0
};
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy", "Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy",
@ -19798,10 +19767,8 @@ static MYSQL_SYSVAR_ULONG(fatal_semaphore_wait_threshold, srv_fatal_semaphore_wa
0); 0);
static const char* srv_encrypt_tables_names[] = { "OFF", "ON", "FORCE", 0 }; static const char* srv_encrypt_tables_names[] = { "OFF", "ON", "FORCE", 0 };
static TYPELIB srv_encrypt_tables_typelib = { static TYPELIB srv_encrypt_tables_typelib =
array_elements(srv_encrypt_tables_names)-1, 0, srv_encrypt_tables_names, CREATE_TYPELIB_FOR(srv_encrypt_tables_names);
NULL
};
static MYSQL_SYSVAR_ENUM(encrypt_tables, srv_encrypt_tables, static MYSQL_SYSVAR_ENUM(encrypt_tables, srv_encrypt_tables,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Enable encryption for tables. " "Enable encryption for tables. "

View file

@ -633,9 +633,7 @@ Recover (repair)/ options (When using '--recover' or '--safe-recover'):\n\
const char *maria_stats_method_names[] = {"nulls_unequal", "nulls_equal", const char *maria_stats_method_names[] = {"nulls_unequal", "nulls_equal",
"nulls_ignored", NullS}; "nulls_ignored", NullS};
TYPELIB maria_stats_method_typelib= { TYPELIB maria_stats_method_typelib= CREATE_TYPELIB_FOR(maria_stats_method_names);
array_elements(maria_stats_method_names) - 1, "",
maria_stats_method_names, NULL};
/* Read options */ /* Read options */

View file

@ -32,7 +32,7 @@
#include <welcome_copyright_notice.h> #include <welcome_copyright_notice.h>
static const char *op_types[]= {"to_s3", "from_s3", "delete_from_s3", NullS}; static const char *op_types[]= {"to_s3", "from_s3", "delete_from_s3", NullS};
static TYPELIB op_typelib= {array_elements(op_types)-1,"", op_types, NULL}; static TYPELIB op_typelib= CREATE_TYPELIB_FOR(op_types);
#define OP_IMPOSSIBLE array_elements(op_types) #define OP_IMPOSSIBLE array_elements(op_types)
static const char *load_default_groups[]= { "aria_s3_copy", 0 }; static const char *load_default_groups[]= { "aria_s3_copy", 0 };

View file

@ -87,55 +87,35 @@ const char *maria_recover_names[]=
*/ */
"NORMAL", "BACKUP", "FORCE", "QUICK", "OFF", NullS "NORMAL", "BACKUP", "FORCE", "QUICK", "OFF", NullS
}; };
TYPELIB maria_recover_typelib= TYPELIB maria_recover_typelib= CREATE_TYPELIB_FOR(maria_recover_names);
{
array_elements(maria_recover_names) - 1, "",
maria_recover_names, NULL
};
const char *maria_stats_method_names[]= const char *maria_stats_method_names[]=
{ {
"nulls_unequal", "nulls_equal", "nulls_unequal", "nulls_equal",
"nulls_ignored", NullS "nulls_ignored", NullS
}; };
TYPELIB maria_stats_method_typelib= TYPELIB maria_stats_method_typelib= CREATE_TYPELIB_FOR(maria_stats_method_names);
{
array_elements(maria_stats_method_names) - 1, "",
maria_stats_method_names, NULL
};
/* transactions log purge mode */ /* transactions log purge mode */
const char *maria_translog_purge_type_names[]= const char *maria_translog_purge_type_names[]=
{ {
"immediate", "external", "at_flush", NullS "immediate", "external", "at_flush", NullS
}; };
TYPELIB maria_translog_purge_type_typelib= TYPELIB maria_translog_purge_type_typelib= CREATE_TYPELIB_FOR(maria_translog_purge_type_names);
{
array_elements(maria_translog_purge_type_names) - 1, "",
maria_translog_purge_type_names, NULL
};
/* transactional log directory sync */ /* transactional log directory sync */
const char *maria_sync_log_dir_names[]= const char *maria_sync_log_dir_names[]=
{ {
"NEVER", "NEWFILE", "ALWAYS", NullS "NEVER", "NEWFILE", "ALWAYS", NullS
}; };
TYPELIB maria_sync_log_dir_typelib= TYPELIB maria_sync_log_dir_typelib= CREATE_TYPELIB_FOR(maria_sync_log_dir_names);
{
array_elements(maria_sync_log_dir_names) - 1, "",
maria_sync_log_dir_names, NULL
};
/* transactional log group commit */ /* transactional log group commit */
const char *maria_group_commit_names[]= const char *maria_group_commit_names[]=
{ {
"none", "hard", "soft", NullS "none", "hard", "soft", NullS
}; };
TYPELIB maria_group_commit_typelib= TYPELIB maria_group_commit_typelib= CREATE_TYPELIB_FOR(maria_group_commit_names);
{
array_elements(maria_group_commit_names) - 1, "",
maria_group_commit_names, NULL
};
/** Interval between background checkpoints in seconds */ /** Interval between background checkpoints in seconds */
static ulong checkpoint_interval; static ulong checkpoint_interval;

View file

@ -40,8 +40,7 @@ static int s3_read_file_from_disk(const char *filename, uchar **to,
/* Used by ha_s3.cc and tools to define different protocol options */ /* Used by ha_s3.cc and tools to define different protocol options */
static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "Path", "Domain", NullS}; static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "Path", "Domain", NullS};
TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"", TYPELIB s3_protocol_typelib= CREATE_TYPELIB_FOR(protocol_types);
protocol_types, NULL};
static const char *providers[]= {"Default", "Amazon", "Huawei", NullS}; static const char *providers[]= {"Default", "Amazon", "Huawei", NullS};
TYPELIB s3_provider_typelib = {array_elements(providers)-1,"",providers, NULL}; TYPELIB s3_provider_typelib = {array_elements(providers)-1,"",providers, NULL};

View file

@ -656,12 +656,8 @@ static const char *mrn_boolean_mode_sytnax_flag_names[] = {
"ALLOW_LEADING_NOT", "ALLOW_LEADING_NOT",
NullS NullS
}; };
static TYPELIB mrn_boolean_mode_syntax_flags_typelib = { static TYPELIB mrn_boolean_mode_syntax_flags_typelib =
array_elements(mrn_boolean_mode_sytnax_flag_names) - 1, CREATE_TYPELIB_FOR(mrn_boolean_mode_sytnax_flag_names);
"",
mrn_boolean_mode_sytnax_flag_names,
NULL
};
#endif #endif
#ifdef MRN_GROONGA_EMBEDDED #ifdef MRN_GROONGA_EMBEDDED
static mrn_bool mrn_libgroonga_embedded = true; static mrn_bool mrn_libgroonga_embedded = true;
@ -747,12 +743,8 @@ static const char *mrn_log_level_type_names[] = {
"DUMP", "DUMP",
NullS NullS
}; };
static TYPELIB mrn_log_level_typelib = { static TYPELIB mrn_log_level_typelib =
array_elements(mrn_log_level_type_names) - 1, CREATE_TYPELIB_FOR(mrn_log_level_type_names);
"mrn_log_level_typelib",
mrn_log_level_type_names,
NULL
};
static void mrn_log_level_update(THD *thd, struct st_mysql_sys_var *var, static void mrn_log_level_update(THD *thd, struct st_mysql_sys_var *var,
void *var_ptr, const void *save) void *var_ptr, const void *save)
@ -1075,12 +1067,7 @@ static const char *mrn_action_on_error_names[] = {
}; };
static TYPELIB mrn_action_on_error_typelib = static TYPELIB mrn_action_on_error_typelib =
{ CREATE_TYPELIB_FOR(mrn_action_on_error_names);
array_elements(mrn_action_on_error_names) - 1,
"mrn_action_on_error_typelib",
mrn_action_on_error_names,
NULL
};
static MYSQL_THDVAR_ENUM(action_on_fulltext_query_error, static MYSQL_THDVAR_ENUM(action_on_fulltext_query_error,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,

View file

@ -41,14 +41,12 @@ static ulong opt_myisam_block_size;
/* bits in myisam_recover_options */ /* bits in myisam_recover_options */
const char *myisam_recover_names[] = const char *myisam_recover_names[] =
{ "DEFAULT", "BACKUP", "FORCE", "QUICK", "BACKUP_ALL", "OFF", NullS}; { "DEFAULT", "BACKUP", "FORCE", "QUICK", "BACKUP_ALL", "OFF", NullS};
TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names)-1,"", TYPELIB myisam_recover_typelib= CREATE_TYPELIB_FOR(myisam_recover_names);
myisam_recover_names, NULL};
const char *myisam_stats_method_names[] = {"NULLS_UNEQUAL", "NULLS_EQUAL", const char *myisam_stats_method_names[] = {"NULLS_UNEQUAL", "NULLS_EQUAL",
"NULLS_IGNORED", NullS}; "NULLS_IGNORED", NullS};
TYPELIB myisam_stats_method_typelib= { TYPELIB myisam_stats_method_typelib=
array_elements(myisam_stats_method_names) - 1, "", CREATE_TYPELIB_FOR(myisam_stats_method_names);
myisam_stats_method_names, NULL};
static MYSQL_SYSVAR_ULONG(block_size, opt_myisam_block_size, static MYSQL_SYSVAR_ULONG(block_size, opt_myisam_block_size,
PLUGIN_VAR_READONLY | PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_READONLY | PLUGIN_VAR_RQCMDARG,

View file

@ -457,9 +457,8 @@ static void usage(void)
const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal",
"nulls_ignored", NullS}; "nulls_ignored", NullS};
TYPELIB myisam_stats_method_typelib= { TYPELIB myisam_stats_method_typelib=
array_elements(myisam_stats_method_names) - 1, "", CREATE_TYPELIB_FOR(myisam_stats_method_names);
myisam_stats_method_names, NULL};
/* Read options */ /* Read options */

View file

@ -26,8 +26,7 @@
LIST *myrg_open_list=0; LIST *myrg_open_list=0;
static const char *merge_insert_methods[] = static const char *merge_insert_methods[] =
{ "FIRST", "LAST", NullS }; { "FIRST", "LAST", NullS };
TYPELIB merge_insert_method= { array_elements(merge_insert_methods)-1,"", TYPELIB merge_insert_method= CREATE_TYPELIB_FOR(merge_insert_methods);
merge_insert_methods, 0};
PSI_memory_key rg_key_memory_MYRG_INFO; PSI_memory_key rg_key_memory_MYRG_INFO;
PSI_memory_key rg_key_memory_children; PSI_memory_key rg_key_memory_children;

View file

@ -768,17 +768,13 @@ static std::shared_ptr<rocksdb::RateLimiter> rocksdb_rate_limiter;
static const char *write_policy_names[] = {"write_committed", "write_prepared", static const char *write_policy_names[] = {"write_committed", "write_prepared",
"write_unprepared", NullS}; "write_unprepared", NullS};
static TYPELIB write_policy_typelib = {array_elements(write_policy_names) - 1, static TYPELIB write_policy_typelib = CREATE_TYPELIB_FOR(write_policy_names);
"write_policy_typelib",
write_policy_names, nullptr};
#if 0 // MARIAROCKS_NOT_YET : read-free replication is not supported #if 0 // MARIAROCKS_NOT_YET : read-free replication is not supported
/* This array needs to be kept up to date with myrocks::read_free_rpl_type */ /* This array needs to be kept up to date with myrocks::read_free_rpl_type */
static const char *read_free_rpl_names[] = {"OFF", "PK_ONLY", "PK_SK", NullS}; static const char *read_free_rpl_names[] = {"OFF", "PK_ONLY", "PK_SK", NullS};
static TYPELIB read_free_rpl_typelib = {array_elements(read_free_rpl_names) - 1, static TYPELIB read_free_rpl_typelib = CREATE_TYPELIB_FOR(read_free_rpl_names);
"read_free_rpl_typelib",
read_free_rpl_names, nullptr};
#endif #endif
/* This enum needs to be kept up to date with rocksdb::InfoLogLevel */ /* This enum needs to be kept up to date with rocksdb::InfoLogLevel */
@ -786,9 +782,7 @@ static const char *info_log_level_names[] = {"debug_level", "info_level",
"warn_level", "error_level", "warn_level", "error_level",
"fatal_level", NullS}; "fatal_level", NullS};
static TYPELIB info_log_level_typelib = { static TYPELIB info_log_level_typelib = CREATE_TYPELIB_FOR(info_log_level_names);
array_elements(info_log_level_names) - 1, "info_log_level_typelib",
info_log_level_names, nullptr};
static void rocksdb_set_rocksdb_info_log_level( static void rocksdb_set_rocksdb_info_log_level(
THD *const thd, struct st_mysql_sys_var *const var, void *const var_ptr, THD *const thd, struct st_mysql_sys_var *const var, void *const var_ptr,
@ -903,9 +897,7 @@ static int rocksdb_compact_column_family(THD *const thd,
static const char *index_type_names[] = {"kBinarySearch", "kHashSearch", NullS}; static const char *index_type_names[] = {"kBinarySearch", "kHashSearch", NullS};
static TYPELIB index_type_typelib = {array_elements(index_type_names) - 1, static TYPELIB index_type_typelib = CREATE_TYPELIB_FOR(index_type_names);
"index_type_typelib", index_type_names,
nullptr};
const ulong RDB_MAX_LOCK_WAIT_SECONDS = 1024 * 1024 * 1024; const ulong RDB_MAX_LOCK_WAIT_SECONDS = 1024 * 1024 * 1024;
const ulong RDB_DEFAULT_MAX_ROW_LOCKS = 1024 * 1024; const ulong RDB_DEFAULT_MAX_ROW_LOCKS = 1024 * 1024;