From 0cb445733bb0265cf4d5eea8b7f9fe1f71dd01f4 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Wed, 16 Sep 2015 13:40:45 +0200 Subject: [PATCH] mon/Monitor.cc: replace inefficient usage of string::find() with compare() Signed-off-by: Danny Al-Gaaf --- src/mon/Monitor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a6e9b1f2da60d..1cacc5d7f1fad 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -319,7 +319,7 @@ void Monitor::do_admin_command(string command, cmdmap_t& cmdmap, string format, goto abort; } sync_force(f.get(), ss); - } else if (command.find("add_bootstrap_peer_hint") == 0) { + } else if (command.compare(0, 23, "add_bootstrap_peer_hint") == 0) { if (!_add_bootstrap_peer_hint(command, cmdmap, ss)) goto abort; } else if (command == "quorum enter") { @@ -1676,7 +1676,7 @@ void Monitor::handle_probe_reply(MonOpRequestRef op) // rename peer? string peer_name = monmap->get_name(m->get_source_addr()); - if (monmap->get_epoch() == 0 && peer_name.find("noname-") == 0) { + if (monmap->get_epoch() == 0 && peer_name.compare(0, 7, "noname-") == 0) { dout(10) << " renaming peer " << m->get_source_addr() << " " << peer_name << " -> " << m->name << " in my monmap" << dendl; -- 2.39.5