F #4936: Reduce number of new/delete, use unique_ptr (#212)

* On exit stop RequestManager first

* Use unique_ptr for pointers to Template

* Reduce number of new/delete
This commit is contained in:
Pavel Czerný authored and GitHub committed 2020-09-15 11:16:00 +02:00
1 parent 80bb014c8d
commit 3ea67d3645
104 files changed
+619 -802

No files matched your search

+4 -8
View File
@@ -658,19 +658,17 @@ int VirtualMachine::parse_file_attribute(string attribute,
int VirtualMachine::parse_public_clouds(const char * pname, string& error)
{
vector<VectorAttribute *> attrs;
vector<VectorAttribute *>::iterator it;
string * str;
string p_vatt;
int rc = 0;
int num = user_obj_template->remove(pname, attrs);
for (it = attrs.begin(); it != attrs.end(); it++)
for (auto attr : attrs)
{
str = (*it)->marshall();
string str = attr->marshall();
if ( str == 0 )
if ( str.empty() )
{
ostringstream oss;
oss << "Internal error processing " << pname;
@@ -679,9 +677,7 @@ int VirtualMachine::parse_public_clouds(const char * pname, string& error)
break;
}
rc = parse_template_attribute(*str, p_vatt, error);
delete str;
rc = parse_template_attribute(str, p_vatt, error);
if ( rc != 0 )
{