]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
encoding.h: fix compiler warning
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 3 Nov 2010 19:15:20 +0000 (12:15 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 3 Nov 2010 19:19:05 +0000 (12:19 -0700)
Fix a compiler warning about an uninitialized variable. Basically, we
used to insert uninitialized values into a std::multimap and then fix
them later. Rather than doing that, just insert the value we want
directly into the map.

Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
src/include/encoding.h

index 0e3c55f7d296d70ec2091720ef818114d656c389..1a08b21ace5268019d9dab7776d781574be6f4a3 100644 (file)
@@ -450,12 +450,10 @@ inline void decode(std::multimap<T,U>& m, bufferlist::iterator& p)
   decode(n, p);
   m.clear();
   while (n--) {
-    T k;
-    decode(k, p);
-    typename std::multimap<T,U>::iterator it;
-    U u;
-    it = m.insert(std::pair<T,U>(k, u));
-    decode(it->second, p);
+    typename std::pair<T,U> val;
+    decode(val.first, p);
+    decode(val.second, p);
+    m.insert(val);
   }
 }