Commit 0bab5481 authored by Monty's avatar Monty Committed by Sergei Petrunia

Remove strlen() from Item::cleanup

parent 01760333
......@@ -411,7 +411,7 @@ int Item::save_str_value_in_field(Field *field, String *result)
Item::Item(THD *thd):
name(null_clex_str), orig_name(0), is_expensive_cache(-1)
name(null_clex_str), orig_name(null_clex_str), is_expensive_cache(-1)
{
DBUG_ASSERT(thd);
base_flags= item_base_t::FIXED;
......@@ -444,7 +444,7 @@ Item::Item(THD *thd):
*/
Item::Item():
name(null_clex_str), orig_name(0), is_expensive_cache(-1)
name(null_clex_str), orig_name(null_clex_str), is_expensive_cache(-1)
{
DBUG_ASSERT(!mysqld_server_started); // Created early
base_flags= item_base_t::FIXED;
......@@ -552,11 +552,8 @@ void Item::cleanup()
DBUG_PRINT("enter", ("this: %p", this));
marker= MARKER_UNUSED;
join_tab_idx= MAX_TABLES;
if (orig_name)
{
name.str= orig_name;
name.length= strlen(orig_name);
}
if (orig_name.str)
name= orig_name;
DBUG_VOID_RETURN;
}
......
......@@ -1035,7 +1035,7 @@ class Item :public Value_source,
LEX_CSTRING name; /* Name of item */
/* Original item name (if it was renamed)*/
const char *orig_name;
LEX_CSTRING orig_name;
/* All common bool variables for an Item is stored here */
item_base_t base_flags;
......
......@@ -67,8 +67,8 @@ static void make_unique_view_field_name(THD *thd, Item *target,
List<Item> &item_list,
Item *last_element)
{
const char *name= (target->orig_name ?
target->orig_name :
const char *name= (target->orig_name.str ?
target->orig_name.str :
target->name.str);
size_t name_len;
uint attempt;
......@@ -100,8 +100,8 @@ static void make_unique_view_field_name(THD *thd, Item *target,
itc.rewind();
}
if (!target->orig_name)
target->orig_name= target->name.str;
if (!target->orig_name.str)
target->orig_name= target->name;
target->set_name(thd, buff, name_len, system_charset_info);
}
......@@ -186,7 +186,7 @@ void make_valid_column_names(THD *thd, List<Item> &item_list)
if (item->is_explicit_name() || !check_column_name(item->name.str))
continue;
name_len= my_snprintf(buff, NAME_LEN, "Name_exp_%u", column_no);
item->orig_name= item->name.str;
item->orig_name= item->name;
item->set_name(thd, buff, name_len, system_charset_info);
}
......
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