From: Sage Weil Date: Wed, 19 Jul 2017 20:57:16 +0000 (-0400) Subject: mon: constify _get_moncommand X-Git-Tag: v12.1.2~196^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3e89e324551d4930855e75ebae75a8f9730f5706;p=ceph.git mon: constify _get_moncommand Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 29da4cd4c47d..86cfa91e6b38 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2810,11 +2810,13 @@ void Monitor::_generate_command_map(map& cmdmap, } } -const MonCommand *Monitor::_get_moncommand(const string &cmd_prefix, - MonCommand *cmds, int cmds_size) +const MonCommand *Monitor::_get_moncommand( + const string &cmd_prefix, + const MonCommand *cmds, + int cmds_size) { - MonCommand *this_cmd = NULL; - for (MonCommand *cp = cmds; + const MonCommand *this_cmd = NULL; + for (const MonCommand *cp = cmds; cp < &cmds[cmds_size]; cp++) { if (cp->cmdstring.compare(0, cmd_prefix.size(), cmd_prefix) == 0) { this_cmd = cp; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 7bed317ddf01..fafadada9984 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -685,8 +685,10 @@ public: static void _generate_command_map(map& cmdmap, map ¶m_str_map); - static const MonCommand *_get_moncommand(const string &cmd_prefix, - MonCommand *cmds, int cmds_size); + static const MonCommand *_get_moncommand( + const string &cmd_prefix, + const MonCommand *cmds, + int cmds_size); bool _allowed_command(MonSession *s, string &module, string &prefix, const map& cmdmap, const map& param_str_map,