]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: fix cmd_getval constness
authorJohn Spray <john.spray@redhat.com>
Tue, 23 Sep 2014 11:21:14 +0000 (12:21 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 8 Oct 2014 10:58:19 +0000 (11:58 +0100)
...so that one can pass in a const cmdmap.

Signed-off-by: John Spray <john.spray@redhat.com>
src/common/cmdparse.h

index 10e43ab0abe66f771fd53fd01ce2f7ad4dd765c6..97c082037f7619904e750c6e2c03dd48711ce849 100644 (file)
@@ -40,11 +40,11 @@ std::string cmd_vartype_stringify(const cmd_vartype& v);
 
 template <typename T>
 bool
-cmd_getval(CephContext *cct, cmdmap_t& cmdmap, std::string k, T& val)
+cmd_getval(CephContext *cct, const cmdmap_t& cmdmap, std::string k, T& val)
 {
   if (cmdmap.count(k)) {
     try {
-      val = boost::get<T>(cmdmap[k]);
+      val = boost::get<T>(cmdmap.find(k)->second);
       return true;
     } catch (boost::bad_get) {
       handle_bad_get(cct, k, typeid(T).name());