From: David Reiss Date: Thu, 23 Aug 2007 02:37:19 +0000 (+0000) Subject: Thrift: No using namespace. X-Git-Tag: 0.2.0~1254 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d4a269cdb5ecf62e91384e33cdb6bf887f69e9a9;p=common%2Fthrift.git Thrift: No using namespace. Summary: using namespace XXX; is tricky because it imports a lot of crap into your namespace. Also, if we ever decide to remove boost as a dependency, "using namespace boost" makes it harder. This patch removes all using namesapce XXX; with one or more using XXX::YYY; There are some exceptions, such as test, tutorial, namespace std, and facebook namespaces. Reviewed By: mcslee Test Plan: Recompiled thrift. grep --binary-files=without-match -r 'using namespace' . | \ egrep -v '^[^:]*: *using namespace (std;$|facebook)' | \ grep -v '<< endl' | \ grep -v '[^:]*/tutorial/' | \ grep -v '^./test/' Revert Plan: ok Notes: I wouldn't bother, but it is fixathon. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665218 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cpp b/lib/cpp/src/concurrency/PosixThreadFactory.cpp index 3f356811..27c5dfa2 100644 --- a/lib/cpp/src/concurrency/PosixThreadFactory.cpp +++ b/lib/cpp/src/concurrency/PosixThreadFactory.cpp @@ -16,7 +16,8 @@ namespace facebook { namespace thrift { namespace concurrency { -using namespace boost; +using boost::shared_ptr; +using boost::weak_ptr; /** * The POSIX thread class. diff --git a/lib/cpp/src/concurrency/ThreadManager.cpp b/lib/cpp/src/concurrency/ThreadManager.cpp index d8b1e8c9..eec94be0 100644 --- a/lib/cpp/src/concurrency/ThreadManager.cpp +++ b/lib/cpp/src/concurrency/ThreadManager.cpp @@ -20,7 +20,8 @@ namespace facebook { namespace thrift { namespace concurrency { -using namespace boost; +using boost::shared_ptr; +using boost::dynamic_pointer_cast; /** * ThreadManager class diff --git a/lib/cpp/src/transport/TServerSocket.cpp b/lib/cpp/src/transport/TServerSocket.cpp index 9182da7e..ed86000e 100644 --- a/lib/cpp/src/transport/TServerSocket.cpp +++ b/lib/cpp/src/transport/TServerSocket.cpp @@ -20,7 +20,7 @@ namespace facebook { namespace thrift { namespace transport { using namespace std; -using namespace boost; +using boost::shared_ptr; TServerSocket::TServerSocket(int port) : port_(port),