From: Sam Lang Date: Tue, 26 Feb 2013 18:22:47 +0000 (-0600) Subject: include/elist: Fix clear() to use pop_front() X-Git-Tag: v0.60~55 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb07745c75bb00d8d520995990ea8eeb51c4e41b;p=ceph.git include/elist: Fix clear() to use pop_front() elist::clear() is calling remove(), which isn't a method defined on elist (it was never defined according to git). Because elist is templated and no references to clear() are ever made, the compiler matches remove(T) to the remove(const char *) system call defined in stdio.h. Once clear is invoked on an instance of elist, we get the compile error shown below. The fix here is to use pop_front() instead of remove(). Compile error is: In file included from ../../src/mds/CInode.h:22:0, from ../../src/mds/CInode.cc:19: ../../src/include/elist.h: In instantiation of ‘void elist::clear() [with T = cinode_backtrace_info_t*]’: ../../src/mds/CInode.cc:1129:20: required from here ../../src/include/elist.h:101:7: error: no matching function for call to ‘remove(cinode_backtrace_info_t*)’ ../../src/include/elist.h:101:7: note: candidates are: In file included from ../../src/mds/CInode.cc:17:0: /usr/include/stdio.h:179:12: note: int remove(const char*) /usr/include/stdio.h:179:12: note: no known conversion for argument 1 from ‘cinode_backtrace_info_t*’ to ‘const char*’ In file included from /usr/include/c++/4.7/algorithm:63:0, from /usr/include/c++/4.7/backward/hashtable.h:65, from /usr/include/c++/4.7/ext/hash_map:65, from ../../src/include/encoding.h:292, from ../../src/common/entity_name.h:22, from ../../src/common/config.h:26, from ../../src/mds/CInode.h:20, from ../../src/mds/CInode.cc:19: /usr/include/c++/4.7/bits/stl_algo.h:1117:5: note: template _FIter std::remove(_FIter, _FIter, const _Tp&) /usr/include/c++/4.7/bits/stl_algo.h:1117:5: note: template argument deduction/substitution failed: In file included from ../../src/mds/CInode.h:22:0, from ../../src/mds/CInode.cc:19: ../../src/include/elist.h:101:7: note: candidate expects 3 arguments, 1 provided Signed-off-by: Sam Lang Reviewed-by: Greg Farnum --- diff --git a/src/include/elist.h b/src/include/elist.h index 03ed0f33b5b5..c5d0e8ac971b 100644 --- a/src/include/elist.h +++ b/src/include/elist.h @@ -98,7 +98,7 @@ public: void clear() { while (!_head.empty()) - remove(front()); + pop_front(); } void push_front(item *i) {