Permalink
Browse files

not returning temporary objects, even inside the object itself

  • Loading branch information...
1 parent e1616cd commit 1840272741916cea443c6bf05a3908d61e790681 @morgner committed Jul 18, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 system/include/environment.h
@@ -152,23 +152,24 @@ class CEnvironment : public std::map<std::string, std::string>
operator option* () { return &this->front(); }
operator option& () { return this->front(); }
- const std::string& ShortOptionsGet() { return m_sShortOpt; }
+ const std::string ShortOptionsGet() { return m_sShortOpt; }
bool hasShortOption( const int c )
{
return ShortOptionsGet().find( (char)c ) != std::string::npos;
}
- const std::string& LongOptionByShortOption( const int c )
+ std::string LongOptionByShortOption( const int c )
{
+ const static std::string sUnknown = "unknown";
for ( iterator it=begin(); it != end(); ++it )
{
if ( it->val == c )
{
return it->name;
}
}
- return "unknown";
+ return sUnknown;
}
void UsagePrint()

0 comments on commit 1840272

Please sign in to comment.