Codechange: Redundant use of char * and c_str(). (#11454)

This commit is contained in:
Peter Nelson
2023-11-10 00:17:36 +00:00
committed by GitHub
parent 938c8339d2
commit 1071acb483
6 changed files with 11 additions and 11 deletions

View File

@@ -106,19 +106,19 @@ struct BaseSet {
* @param isocode the isocode to search for
* @return the description
*/
const char *GetDescription(const std::string &isocode) const
const std::string &GetDescription(const std::string &isocode) const
{
if (!isocode.empty()) {
/* First the full ISO code */
auto desc = this->description.find(isocode);
if (desc != this->description.end()) return desc->second.c_str();
if (desc != this->description.end()) return desc->second;
/* Then the first two characters */
desc = this->description.find(isocode.substr(0, 2));
if (desc != this->description.end()) return desc->second.c_str();
if (desc != this->description.end()) return desc->second;
}
/* Then fall back */
return this->description.at(std::string{}).c_str();
return this->description.at(std::string{});
}
/**