Skip to content

Commit

Permalink
Remove extra string constructors that aren't necessary anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
InsertCreativityHere committed Nov 1, 2024
1 parent 04594d5 commit dca653d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cpp/src/Slice/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Slice::DefinitionContext::getMetadataArgs(string_view directive) const
{
if (p->directive() == directive)
{
return string{p->arguments()};
return p->arguments();
}
}
return nullopt;
Expand Down Expand Up @@ -974,7 +974,7 @@ Slice::Contained::getMetadataArgs(string_view directive) const
{
if (p->directive() == directive)
{
return string{p->arguments()};
return p->arguments();
}
}
return nullopt;
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/slice2cpp/CPlusPlusUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,13 +956,13 @@ Slice::findMetadata(const MetadataList& metadata, TypeContext typeCtx)
{
if (directive == "cpp:view-type")
{
return string{meta->arguments()};
return meta->arguments();
}
}

if (directive == "cpp:type")
{
return string{meta->arguments()};
return meta->arguments();
}

if ((typeCtx & (TypeContext::MarshalParam | TypeContext::UnmarshalParamZeroCopy)) != TypeContext::None)
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/slice2cs/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ Slice::Gen::TypesVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p)
{
if (metadata->directive() == "cs:implements")
{
baseNames.push_back(string{metadata->arguments()});
baseNames.push_back(metadata->arguments());
}
}

Expand Down Expand Up @@ -1952,7 +1952,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
if (metadata->directive() == "cs:implements")
{
baseNames.push_back(string{metadata->arguments()});
baseNames.push_back(metadata->arguments());
}
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/slice2java/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if (metadata->directive() == "java:implements")
{
implements.push_back(string{metadata->arguments()});
implements.push_back(metadata->arguments());
}
}

Expand Down Expand Up @@ -2933,7 +2933,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
if (metadata->directive() == "java:implements")
{
implements.push_back(string{metadata->arguments()});
implements.push_back(metadata->arguments());
}
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/slice2java/JavaUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2277,16 +2277,16 @@ Slice::JavaGenerator::getTypeMetadata(const MetadataList& metadata, string& inst
{
if (m->directive() == "java:type")
{
string_view arguments = m->arguments();
string arguments = m->arguments();
string::size_type pos = arguments.find(':');
if (pos != string::npos)
{
instanceType = string{arguments.substr(0, pos)};
formalType = string{arguments.substr(pos + 1)};
instanceType = arguments.substr(0, pos);
formalType = arguments.substr(pos + 1);
}
else
{
instanceType = string{arguments};
instanceType = arguments;
formalType.clear();
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/slice2swift/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ Gen::ObjectVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p)
{
if (metadata->directive() == "swift:inherits")
{
baseNames.push_back(string{metadata->arguments()});
baseNames.push_back(metadata->arguments());
}
}

Expand Down

0 comments on commit dca653d

Please sign in to comment.