@@ -164,6 +164,7 @@ Virtual_Machine::Virtual_Machine(const Virtual_Machine& vm)
164
164
this ->Use_Redirections = vm.Get_Use_Redirections ();
165
165
166
166
this ->Network_Cards .clear ();
167
+ this ->Network_Cards .reserve (vm.Get_Network_Cards_Count ());
167
168
for (int nx = 0 ; nx < vm.Get_Network_Cards_Count (); nx++) {
168
169
VM_Net_Card n_card = vm.Get_Network_Card (nx);
169
170
@@ -175,6 +176,7 @@ Virtual_Machine::Virtual_Machine(const Virtual_Machine& vm)
175
176
this ->Network_Cards_Native = vm.Get_Network_Cards_Native ();
176
177
177
178
this ->Network_Redirections .clear ();
179
+ this ->Network_Redirections .reserve (vm.Get_Network_Redirections_Count ());
178
180
for (int rx = 0 ; rx < vm.Get_Network_Redirections_Count (); rx++) {
179
181
VM_Redirection n_redir = vm.Get_Network_Redirection (rx);
180
182
@@ -190,6 +192,7 @@ Virtual_Machine::Virtual_Machine(const Virtual_Machine& vm)
190
192
191
193
// USB
192
194
this ->USB_Ports .clear ();
195
+ this ->USB_Ports .reserve (vm.Get_USB_Ports ().count ());
193
196
for (int ux = 0 ; ux < vm.Get_USB_Ports ().count (); ++ux) {
194
197
this ->USB_Ports .append (VM_USB (vm.Get_USB_Ports ()[ux]));
195
198
}
@@ -727,6 +730,7 @@ Virtual_Machine& Virtual_Machine::operator=(const Virtual_Machine& vm)
727
730
this ->Use_Redirections = vm.Get_Use_Redirections ();
728
731
729
732
this ->Network_Cards .clear ();
733
+ this ->Network_Cards .reserve (vm.Get_Network_Cards_Count ());
730
734
for (int nx = 0 ; nx < vm.Get_Network_Cards_Count (); nx++) {
731
735
VM_Net_Card n_card = vm.Get_Network_Card (nx);
732
736
@@ -738,6 +742,7 @@ Virtual_Machine& Virtual_Machine::operator=(const Virtual_Machine& vm)
738
742
this ->Network_Cards_Native = vm.Get_Network_Cards_Native ();
739
743
740
744
this ->Network_Redirections .clear ();
745
+ this ->Network_Redirections .reserve (vm.Get_Network_Redirections_Count ());
741
746
for (int rx = 0 ; rx < vm.Get_Network_Redirections_Count (); rx++) {
742
747
VM_Redirection n_redir = vm.Get_Network_Redirection (rx);
743
748
@@ -752,6 +757,7 @@ Virtual_Machine& Virtual_Machine::operator=(const Virtual_Machine& vm)
752
757
this ->Parallel_Ports = vm.Get_Parallel_Ports ();
753
758
754
759
this ->USB_Ports .clear ();
760
+ this ->USB_Ports .reserve (vm.Get_USB_Ports ().count ());
755
761
for (int ux = 0 ; ux < vm.Get_USB_Ports ().count (); ++ux) {
756
762
this ->USB_Ports .append (VM_USB (vm.Get_USB_Ports ()[ux]));
757
763
}
@@ -8595,6 +8601,7 @@ void Virtual_Machine::Set_Snapshots(const QList<VM_Snapshot>& list)
8595
8601
{
8596
8602
Snapshots.clear ();
8597
8603
8604
+ Snapshots.reserve (list.count ());
8598
8605
for (int sx = 0 ; sx < list.count (); ++sx) {
8599
8606
Snapshots.append (VM_Snapshot (list[sx]));
8600
8607
}
@@ -8645,6 +8652,7 @@ void Virtual_Machine::Set_Storage_Devices_List(
8645
8652
{
8646
8653
Storage_Devices.clear ();
8647
8654
8655
+ Storage_Devices.reserve (list.count ());
8648
8656
for (int ix = 0 ; ix < list.count (); ++ix) {
8649
8657
Storage_Devices.append (VM_Native_Storage_Device (list[ix]));
8650
8658
}
@@ -8655,6 +8663,7 @@ void Virtual_Machine::Set_Shared_Folders_List(
8655
8663
{
8656
8664
Shared_Folders.clear ();
8657
8665
8666
+ Shared_Folders.reserve (list.count ());
8658
8667
for (int ix = 0 ; ix < list.count (); ++ix) {
8659
8668
Shared_Folders.append (VM_Shared_Folder (list[ix]));
8660
8669
}
@@ -9068,6 +9077,7 @@ void Virtual_Machine::Set_USB_Ports(const QList<VM_USB>& list)
9068
9077
{
9069
9078
USB_Ports.clear ();
9070
9079
9080
+ USB_Ports.reserve (list.count ());
9071
9081
for (int ix = 0 ; ix < list.count (); ++ix) {
9072
9082
USB_Ports.append (VM_USB (list[ix]));
9073
9083
}
0 commit comments