Replaced raw pointer used with ReportsBase-derived classes to make code cleaner and make it to where pointers do not have to be manually deleted.
Closes #4376 --- tester/covoar/ReportsBase.cc | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc index 219e5af..8ec65c0 100644 --- a/tester/covoar/ReportsBase.cc +++ b/tester/covoar/ReportsBase.cc @@ -591,17 +591,16 @@ void GenerateReports( bool branchInfoAvailable ) { - typedef std::list<ReportsBase *> reportList_t; + typedef std::vector<std::unique_ptr<ReportsBase>> reportList_t; reportList_t reportList; reportList_t::iterator ritr; std::string reportName; - ReportsBase* reports; time_t timestamp; timestamp = time( NULL ); /* get current cal time */ - reports = new ReportsText( + reportList.emplace_back(new ReportsText( timestamp, symbolSetName, allExplanations, @@ -609,9 +608,8 @@ void GenerateReports( outputDirectory, symbolsToAnalyze, branchInfoAvailable - ); - reportList.push_back( reports ); - reports = new ReportsHtml( + )); + reportList.emplace_back(new ReportsHtml( timestamp, symbolSetName, allExplanations, @@ -619,11 +617,9 @@ void GenerateReports( outputDirectory, symbolsToAnalyze, branchInfoAvailable - ); - reportList.push_back( reports ); + )); - for ( ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) { - reports = *ritr; + for ( auto& reports: reportList ) { reportName = "index" + reports->ReportExtension(); if ( verbose ) { @@ -662,11 +658,6 @@ void GenerateReports( reports->WriteSymbolSummaryReport( reportName, symbolsToAnalyze ); } - for ( ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) { - reports = *ritr; - delete reports; - } - ReportsBase::WriteSummaryReport( "summary.txt", symbolSetName, -- 1.8.3.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel