From: Danny Al-Gaaf Date: Fri, 13 Oct 2017 19:08:33 +0000 (+0200) Subject: MDSMonitor.cc: use string::compare() X-Git-Tag: v13.0.1~358^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3f1b2ad2d9a9c9811b66e120232909358f0db2ed;p=ceph.git MDSMonitor.cc: use string::compare() Fix for: [src/mon/MDSMonitor.cc:1717]: (performance) Inefficient usage of string::find() in condition; string::compare() would be faster. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index c79790b6f0c..66a4688d7ff 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1549,7 +1549,7 @@ void MDSMonitor::check_sub(Subscription *sub) } else { // You're a client. Did you request a particular // namespace? - if (sub->type.find("mdsmap.") == 0) { + if (sub->type.compare(0, 7, "mdsmap.") == 0) { auto namespace_id_str = sub->type.substr(std::string("mdsmap.").size()); dout(10) << __func__ << ": namespace_id " << namespace_id_str << dendl; std::string err;