]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MDSMonitor.cc: use string::compare()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 13 Oct 2017 19:08:33 +0000 (21:08 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 25 Oct 2017 16:14:05 +0000 (18:14 +0200)
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 <danny.al-gaaf@bisect.de>
src/mon/MDSMonitor.cc

index c79790b6f0c5f11fa35bdf52191fddc4b91b0b54..66a4688d7ffc7d07369d0194918d3074d5ee1722 100644 (file)
@@ -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;