Commit 3bde1393 authored by Monty's avatar Monty

Minor cleanups, fix compiler warnings

parent d87ffeb4
...@@ -98,6 +98,11 @@ static struct my_option my_long_options[] = ...@@ -98,6 +98,11 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
void cleanup_and_exit(int exit_code)
{
my_end(0);
exit(exit_code);
}
static void usage(my_bool version) static void usage(my_bool version)
{ {
...@@ -112,7 +117,7 @@ static void usage(my_bool version) ...@@ -112,7 +117,7 @@ static void usage(my_bool version)
my_print_default_files(config_file); my_print_default_files(config_file);
my_print_variables(my_long_options); my_print_variables(my_long_options);
printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname);
exit(0); cleanup_and_exit(0);
} }
...@@ -125,7 +130,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -125,7 +130,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_defaults_file_used= 1; opt_defaults_file_used= 1;
break; break;
case 'n': case 'n':
exit(0); cleanup_and_exit(0);
case 'I': case 'I':
case '?': case '?':
usage(0); usage(0);
...@@ -174,7 +179,7 @@ int main(int argc, char **argv) ...@@ -174,7 +179,7 @@ int main(int argc, char **argv)
/* Check out the args */ /* Check out the args */
if (get_options(&argc,&argv)) if (get_options(&argc,&argv))
exit(1); cleanup_and_exit(1);
nargs= argc + 1; nargs= argc + 1;
if (opt_mysqld) if (opt_mysqld)
......
...@@ -270,6 +270,7 @@ common_1_lev_code: ...@@ -270,6 +270,7 @@ common_1_lev_code:
static int static int
create_query_string(THD *thd, String *buf) create_query_string(THD *thd, String *buf)
{ {
buf->length(0);
/* Append the "CREATE" part of the query */ /* Append the "CREATE" part of the query */
if (buf->append(STRING_WITH_LEN("CREATE "))) if (buf->append(STRING_WITH_LEN("CREATE ")))
return 1; return 1;
...@@ -380,7 +381,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, ...@@ -380,7 +381,8 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
{ {
/* Binlog the create event. */ /* Binlog the create event. */
DBUG_ASSERT(thd->query() && thd->query_length()); DBUG_ASSERT(thd->query() && thd->query_length());
String log_query; char buffer[1024];
String log_query(buffer, sizeof(buffer), &my_charset_bin);
if (create_query_string(thd, &log_query)) if (create_query_string(thd, &log_query))
{ {
sql_print_error("Event Error: An error occurred while creating query " sql_print_error("Event Error: An error occurred while creating query "
......
...@@ -1414,11 +1414,10 @@ int ha_commit_trans(THD *thd, bool all) ...@@ -1414,11 +1414,10 @@ int ha_commit_trans(THD *thd, bool all)
err= ht->prepare(ht, thd, all); err= ht->prepare(ht, thd, all);
status_var_increment(thd->status_var.ha_prepare_count); status_var_increment(thd->status_var.ha_prepare_count);
if (err) if (err)
{
my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); my_error(ER_ERROR_DURING_COMMIT, MYF(0), err);
if (err)
goto err; goto err;
}
need_prepare_ordered|= (ht->prepare_ordered != NULL); need_prepare_ordered|= (ht->prepare_ordered != NULL);
need_commit_ordered|= (ht->commit_ordered != NULL); need_commit_ordered|= (ht->commit_ordered != NULL);
} }
......
...@@ -1355,8 +1355,8 @@ void THD::init(void) ...@@ -1355,8 +1355,8 @@ void THD::init(void)
mysql_mutex_lock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_global_system_variables);
plugin_thdvar_init(this); plugin_thdvar_init(this);
/* /*
variables= global_system_variables above has reset plugin_thd_var_init() sets variables= global_system_variables, which
variables.pseudo_thread_id to 0. We need to correct it here to has reset variables.pseudo_thread_id to 0. We need to correct it here to
avoid temporary tables replication failure. avoid temporary tables replication failure.
*/ */
variables.pseudo_thread_id= thread_id; variables.pseudo_thread_id= thread_id;
......
...@@ -647,7 +647,7 @@ dict_tf_is_valid( ...@@ -647,7 +647,7 @@ dict_tf_is_valid(
if (atomic_writes) { if (atomic_writes) {
if(atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) { if(atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n" "InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n"
...@@ -689,7 +689,7 @@ dict_sys_tables_type_validate( ...@@ -689,7 +689,7 @@ dict_sys_tables_type_validate(
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type); ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type);
ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type); ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type);
ut_a(atomic_writes >= 0 && atomic_writes <= ATOMIC_WRITES_OFF); ut_a(atomic_writes <= ATOMIC_WRITES_OFF);
/* The low order bit of SYS_TABLES.TYPE is always set to 1. /* The low order bit of SYS_TABLES.TYPE is always set to 1.
If the format is UNIV_FORMAT_B or higher, this field is the same If the format is UNIV_FORMAT_B or higher, this field is the same
...@@ -768,7 +768,7 @@ dict_sys_tables_type_validate( ...@@ -768,7 +768,7 @@ dict_sys_tables_type_validate(
} }
/* Validate that the atomic writes number is within allowed range. */ /* Validate that the atomic writes number is within allowed range. */
if (atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) { if (atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu\n", fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu\n",
type, atomic_writes); type, atomic_writes);
return(ULINT_UNDEFINED); return(ULINT_UNDEFINED);
......
...@@ -122,7 +122,7 @@ dict_tf_get_page_compression_level( ...@@ -122,7 +122,7 @@ dict_tf_get_page_compression_level(
{ {
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags); ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags);
ut_ad(page_compression_level >= 0 && page_compression_level <= 9); ut_ad(page_compression_level <= 9);
return(page_compression_level); return(page_compression_level);
} }
......
...@@ -131,7 +131,7 @@ fsp_flags_is_valid( ...@@ -131,7 +131,7 @@ fsp_flags_is_valid(
} }
} }
if (atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) { if (atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted atomic_writes %lu\n", fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted atomic_writes %lu\n",
flags, atomic_writes); flags, atomic_writes);
return (false); return (false);
......
...@@ -651,7 +651,7 @@ dict_tf_is_valid( ...@@ -651,7 +651,7 @@ dict_tf_is_valid(
if (atomic_writes) { if (atomic_writes) {
if(atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) { if(atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n" "InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n"
...@@ -693,7 +693,7 @@ dict_sys_tables_type_validate( ...@@ -693,7 +693,7 @@ dict_sys_tables_type_validate(
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type); ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type);
ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type); ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type);
ut_a(atomic_writes >= 0 && atomic_writes <= ATOMIC_WRITES_OFF); ut_a(atomic_writes <= ATOMIC_WRITES_OFF);
/* The low order bit of SYS_TABLES.TYPE is always set to 1. /* The low order bit of SYS_TABLES.TYPE is always set to 1.
If the format is UNIV_FORMAT_B or higher, this field is the same If the format is UNIV_FORMAT_B or higher, this field is the same
...@@ -772,7 +772,7 @@ dict_sys_tables_type_validate( ...@@ -772,7 +772,7 @@ dict_sys_tables_type_validate(
} }
/* Validate that the atomic writes number is within allowed range. */ /* Validate that the atomic writes number is within allowed range. */
if (atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) { if (atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu\n", fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu\n",
type, atomic_writes); type, atomic_writes);
return(ULINT_UNDEFINED); return(ULINT_UNDEFINED);
......
...@@ -122,7 +122,7 @@ dict_tf_get_page_compression_level( ...@@ -122,7 +122,7 @@ dict_tf_get_page_compression_level(
{ {
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags); ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(flags);
ut_ad(page_compression_level >= 0 && page_compression_level <= 9); ut_ad(page_compression_level <= 9);
return(page_compression_level); return(page_compression_level);
} }
......
...@@ -135,7 +135,7 @@ fsp_flags_is_valid( ...@@ -135,7 +135,7 @@ fsp_flags_is_valid(
} }
} }
if (atomic_writes < 0 || atomic_writes > ATOMIC_WRITES_OFF) { if (atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted atomic_writes %lu\n", fprintf(stderr, "InnoDB: Error: Tablespace flags %lu corrupted atomic_writes %lu\n",
flags, atomic_writes); flags, atomic_writes);
return (false); return (false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment