ceph_mon.cc: replace string::find() with compare()

Fix for:

[src/ceph_mon.cc:396]: (performance) Inefficient usage of string::find()
 in condition; string::compare() would be faster.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf 2015-09-16 11:11:13 +02:00
parent 30162870fd
commit fd8f18ac35

View File

@ -393,7 +393,7 @@ int main(int argc, const char **argv)
string name;
monmap.get_addr_name(local, name);
if (name.find("noname-") == 0) {
if (name.compare(0, 7, "noname-") == 0) {
cout << argv[0] << ": mon." << name << " " << local
<< " is local, renaming to mon." << g_conf->name.get_id() << std::endl;
monmap.rename(name, g_conf->name.get_id());