Commit e547fbea authored by unknown's avatar unknown

Cleanups to patch for bug #9660 after review by Monty.


sql/sql_table.cc:
  Make return value of build_table_path() useful
  Eliminate some unnecessary casts
parent 8ac75806
...@@ -54,16 +54,16 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, ...@@ -54,16 +54,16 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
ext Filename extension ext Filename extension
RETURN RETURN
FALSE Always -- see usage in mysql_create_indexes() 0 Error
# Size of path
*/ */
static bool build_table_path(char *buff, size_t bufflen, const char *db, static uint build_table_path(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext) const char *table, const char *ext)
{ {
strxnmov(buff, bufflen-1, mysql_data_home, "/", db, "/", table, ext, strxnmov(buff, bufflen-1, mysql_data_home, "/", db, "/", table, ext,
NullS); NullS);
unpack_filename(buff,buff); return unpack_filename(buff,buff);
return FALSE;
} }
...@@ -1611,14 +1611,13 @@ mysql_rename_table(enum db_type base, ...@@ -1611,14 +1611,13 @@ mysql_rename_table(enum db_type base,
to_base= lc_to; to_base= lc_to;
} }
if (!(error=file->rename_table((const char*) from_base, if (!(error=file->rename_table(from_base, to_base)))
(const char *) to_base)))
{ {
if (rename_file_ext(from,to,reg_ext)) if (rename_file_ext(from,to,reg_ext))
{ {
error=my_errno; error=my_errno;
/* Restore old file name */ /* Restore old file name */
file->rename_table((const char*) to_base, (const char *) from_base); file->rename_table(to_base, from_base);
} }
} }
delete file; delete file;
...@@ -2600,7 +2599,8 @@ int mysql_create_indexes(THD *thd, TABLE_LIST *table_list, List<Key> &keys) ...@@ -2600,7 +2599,8 @@ int mysql_create_indexes(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
if (table->file->add_index(table, key_info_buffer, key_count)|| if (table->file->add_index(table, key_info_buffer, key_count)||
build_table_path(path, sizeof(path), table_list->db, build_table_path(path, sizeof(path), table_list->db,
(lower_case_table_names == 2) ? (lower_case_table_names == 2) ?
table_list->alias : table_list->real_name, reg_ext) || table_list->alias : table_list->real_name,
reg_ext) != 0 ||
mysql_create_frm(thd, path, &create_info, mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file)) fields, key_count, key_info_buffer, table->file))
/* don't need to free((gptr) key_info_buffer);*/ /* don't need to free((gptr) key_info_buffer);*/
...@@ -2700,7 +2700,8 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list, ...@@ -2700,7 +2700,8 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
/*select_field_count*/ 0)|| /*select_field_count*/ 0)||
build_table_path(path, sizeof(path), table_list->db, build_table_path(path, sizeof(path), table_list->db,
(lower_case_table_names == 2) ? (lower_case_table_names == 2) ?
table_list->alias : table_list->real_name, reg_ext) || table_list->alias : table_list->real_name,
reg_ext) != 0 ||
mysql_create_frm(thd, path, &create_info, mysql_create_frm(thd, path, &create_info,
fields, key_count, key_info_buffer, table->file)) fields, key_count, key_info_buffer, table->file))
/*don't need to free((gptr) key_numbers);*/ /*don't need to free((gptr) key_numbers);*/
......
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