Index: src/flags.cc |
diff --git a/src/flags.cc b/src/flags.cc |
index d444c976fbbc9c6ca723ccf06cb28cb1401a1644..bbe6bb720e573779fd5f2a44940876c52c9e90ab 100644 |
--- a/src/flags.cc |
+++ b/src/flags.cc |
@@ -470,12 +470,12 @@ static char* SkipBlackSpace(char* p) { |
// static |
int FlagList::SetFlagsFromString(const char* str, int len) { |
// make a 0-terminated copy of str |
- char* copy0 = NewArray<char>(len + 1); |
- memcpy(copy0, str, len); |
+ ScopedVector<char> copy0(len + 1); |
+ memcpy(copy0.start(), str, len); |
copy0[len] = '\0'; |
// strip leading white space |
- char* copy = SkipWhiteSpace(copy0); |
+ char* copy = SkipWhiteSpace(copy0.start()); |
// count the number of 'arguments' |
int argc = 1; // be compatible with SetFlagsFromCommandLine() |
@@ -485,7 +485,7 @@ int FlagList::SetFlagsFromString(const char* str, int len) { |
} |
// allocate argument array |
- char** argv = NewArray<char*>(argc); |
+ ScopedVector<char*> argv(argc); |
// split the flags string into arguments |
argc = 1; // be compatible with SetFlagsFromCommandLine() |
@@ -497,11 +497,7 @@ int FlagList::SetFlagsFromString(const char* str, int len) { |
} |
// set the flags |
- int result = SetFlagsFromCommandLine(&argc, argv, false); |
- |
- // cleanup |
- DeleteArray(argv); |
- DeleteArray(copy0); |
+ int result = SetFlagsFromCommandLine(&argc, argv.start(), false); |
return result; |
} |