Skip to content

Commit

Permalink
remove array allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
hknielsen committed Dec 29, 2023
1 parent cfbdd35 commit 8e9879b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/google/protobuf/compiler/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ std::string ToMultiByteUTF8String(const wchar_t* input)
int main(int argc, char* argv[])
{
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
std::string* argv_mbcs_str = new std::string [argc];
char** argv_mbcs = new char* [argc];
for (int i = 0; i < argc; i++)
{
argv_mbcs_str[i] = ToMultiByteUTF8String(wargv[i]);
argv_mbcs[i] = const_cast<char*>(argv_mbcs_str[i].c_str());
auto multibyte_string = ToMultiByteUTF8String(wargv[i]);
argv_mbcs[i] = const_cast<char*>(multibyte_string.c_str());
}
return google::protobuf::compiler::ProtobufMain(argc, argv_mbcs);
}
Expand Down

0 comments on commit 8e9879b

Please sign in to comment.