summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsJavaParserHelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmDependsJavaParserHelper.cxx')
-rw-r--r--Source/cmDependsJavaParserHelper.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx
index 516bbbf..fc1bbdd 100644
--- a/Source/cmDependsJavaParserHelper.cxx
+++ b/Source/cmDependsJavaParserHelper.cxx
@@ -8,6 +8,7 @@
#include <iostream>
#include <utility>
+#include <cm/memory>
#include <cm/string_view>
#include "cmsys/FStream.hxx"
@@ -169,10 +170,11 @@ void cmDependsJavaParserHelper::AllocateParserType(
return;
}
this->UnionsAvailable++;
- pt->str = new char[len + 1];
+ auto up = cm::make_unique<char[]>(len + 1);
+ pt->str = up.get();
strncpy(pt->str, str, len);
pt->str[len] = 0;
- this->Allocates.push_back(pt->str);
+ this->Allocates.push_back(std::move(up));
}
void cmDependsJavaParserHelper::StartClass(const char* cls)
@@ -275,10 +277,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb)
void cmDependsJavaParserHelper::CleanupParser()
{
- for (char* allocate : this->Allocates) {
- delete[] allocate;
- }
- this->Allocates.erase(this->Allocates.begin(), this->Allocates.end());
+ this->Allocates.clear();
}
int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen)