@@ -73,15 +73,14 @@ partition_info *partition_info::get_clone(THD *thd, bool reset /* = false */)
73
73
DBUG_ENTER (" partition_info::get_clone" );
74
74
List_iterator<partition_element> part_it (partitions);
75
75
partition_element *part;
76
- partition_info *clone= new (*THR_MALLOC) partition_info ();
76
+ partition_info *clone= new (*THR_MALLOC) partition_info (* this );
77
77
if (!clone)
78
78
{
79
79
mem_alloc_error (sizeof (partition_info));
80
80
DBUG_RETURN (NULL );
81
81
}
82
- memcpy (clone, this , sizeof (partition_info));
83
- memset (&(clone->read_partitions ), 0 , sizeof (clone->read_partitions ));
84
- memset (&(clone->lock_partitions ), 0 , sizeof (clone->lock_partitions ));
82
+ new (&(clone->read_partitions )) MY_BITMAP;
83
+ new (&(clone->lock_partitions )) MY_BITMAP;
85
84
clone->bitmaps_are_initialized = FALSE ;
86
85
clone->partitions .empty ();
87
86
clone->temp_partitions .empty ();
@@ -90,13 +89,12 @@ partition_info *partition_info::get_clone(THD *thd, bool reset /* = false */)
90
89
{
91
90
List_iterator<partition_element> subpart_it (part->subpartitions );
92
91
partition_element *subpart;
93
- partition_element *part_clone= new (*THR_MALLOC) partition_element ();
92
+ partition_element *part_clone= new (*THR_MALLOC) partition_element (*part );
94
93
if (!part_clone)
95
94
{
96
95
mem_alloc_error (sizeof (partition_element));
97
96
DBUG_RETURN (NULL );
98
97
}
99
- memcpy (part_clone, part, sizeof (partition_element));
100
98
101
99
/* Explicitly copy the tablespace name, use the thd->mem_root. */
102
100
if (part->tablespace_name != nullptr )
@@ -125,13 +123,12 @@ partition_info *partition_info::get_clone(THD *thd, bool reset /* = false */)
125
123
part_clone->subpartitions .empty ();
126
124
while ((subpart= (subpart_it++)))
127
125
{
128
- partition_element *subpart_clone= new (*THR_MALLOC) partition_element ();
126
+ partition_element *subpart_clone= new (*THR_MALLOC) partition_element (*subpart );
129
127
if (!subpart_clone)
130
128
{
131
129
mem_alloc_error (sizeof (partition_element));
132
130
DBUG_RETURN (NULL );
133
131
}
134
- memcpy (subpart_clone, subpart, sizeof (partition_element));
135
132
136
133
/* Explicitly copy the tablespace name, use the thd->mem_root. */
137
134
if (subpart->tablespace_name != nullptr )
@@ -1885,7 +1882,6 @@ void partition_info::print_no_partition_found(THD *thd, TABLE *table_arg)
1885
1882
char *buf_ptr= (char *)&buf;
1886
1883
TABLE_LIST table_list;
1887
1884
1888
- memset (&table_list, 0 , sizeof (table_list));
1889
1885
table_list.db = table_arg->s ->db .str ;
1890
1886
table_list.table_name = table_arg->s ->table_name .str ;
1891
1887
0 commit comments