Commit c8cba4af authored by Eugene Kosov's avatar Eugene Kosov Committed by Sergey Vojtovich

remove unneeded allocation

parent 46cf2218
......@@ -166,12 +166,8 @@ bool Partition_share::init(uint num_parts)
auto_inc_initialized= false;
partition_name_hash_initialized= false;
next_auto_inc_val= 0;
partitions_share_refs= new Parts_share_refs;
if (!partitions_share_refs)
DBUG_RETURN(true);
if (partitions_share_refs->init(num_parts))
if (partitions_share_refs.init(num_parts))
{
delete partitions_share_refs;
DBUG_RETURN(true);
}
DBUG_RETURN(false);
......@@ -3305,9 +3301,8 @@ bool ha_partition::set_ha_share_ref(Handler_share **ha_share_arg)
DBUG_RETURN(true);
if (!(part_share= get_share()))
DBUG_RETURN(true);
DBUG_ASSERT(part_share->partitions_share_refs);
DBUG_ASSERT(part_share->partitions_share_refs->num_parts >= m_tot_parts);
ha_shares= part_share->partitions_share_refs->ha_shares;
DBUG_ASSERT(part_share->partitions_share_refs.num_parts >= m_tot_parts);
ha_shares= part_share->partitions_share_refs.ha_shares;
for (i= 0; i < m_tot_parts; i++)
{
if (m_file[i]->set_ha_share_ref(&ha_shares[i]))
......
......@@ -48,10 +48,8 @@ class Parts_share_refs
{
uint i;
for (i= 0; i < num_parts; i++)
if (ha_shares[i])
delete ha_shares[i];
if (ha_shares)
delete [] ha_shares;
delete[] ha_shares;
}
bool init(uint arg_num_parts)
{
......@@ -86,7 +84,7 @@ class Partition_share : public Handler_share
bool partition_name_hash_initialized;
HASH partition_name_hash;
/** Storage for each partitions Handler_share */
Parts_share_refs *partitions_share_refs;
Parts_share_refs partitions_share_refs;
Partition_share() {}
~Partition_share()
{
......@@ -94,8 +92,6 @@ class Partition_share : public Handler_share
mysql_mutex_destroy(&auto_inc_mutex);
if (partition_name_hash_initialized)
my_hash_free(&partition_name_hash);
if (partitions_share_refs)
delete partitions_share_refs;
DBUG_VOID_RETURN;
}
bool init(uint num_parts);
......
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