From: Amos Jeffries Date: Sat, 4 May 2013 11:50:26 +0000 (-0600) Subject: SourceLayout: rename Array.h to base/Vector.h X-Git-Tag: SQUID_3_4_0_1~174 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08f774de9f8aae1a65acc837f32fc9003b15cb1e;p=thirdparty%2Fsquid.git SourceLayout: rename Array.h to base/Vector.h Also moves the unit-test for Vector<> to src/tests. --- diff --git a/include/Stack.h b/include/Stack.h index b15c02d599..fe39f6680f 100644 --- a/include/Stack.h +++ b/include/Stack.h @@ -32,7 +32,7 @@ #ifndef SQUID_STACK_H #define SQUID_STACK_H -#include "Array.h" +#include "base/Vector.h" /* RBC: 20030714 Composition might be better long-term, but for now, * there's no reason to do so. diff --git a/lib/Makefile.am b/lib/Makefile.am index 05d363e8c8..5b7d72cc70 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -78,8 +78,6 @@ TESTS += tests/testAll check_PROGRAMS += tests/testAll tests_testAll_SOURCES= \ - tests/testArray.h \ - tests/testArray.cc \ tests/testRFC1035.h \ tests/testRFC1035.cc \ tests/testRFC1738.h \ diff --git a/lib/tests/testArray.cc b/lib/tests/testArray.cc deleted file mode 100644 index ffbfebbc5a..0000000000 --- a/lib/tests/testArray.cc +++ /dev/null @@ -1,22 +0,0 @@ -#define SQUID_UNIT_TEST 1 -#include "squid.h" - -#if HAVE_ASSERT_H -#include -#endif - -#include "testArray.h" -#include "Array.h" - -CPPUNIT_TEST_SUITE_REGISTRATION( testArray ); - -void testArray::all() -{ - CPPUNIT_ASSERT( 1 == 1 ); - Vector aArray; - CPPUNIT_ASSERT (aArray.size() == 0); - aArray.push_back(2); - CPPUNIT_ASSERT (aArray.size() == 1); - CPPUNIT_ASSERT (aArray.back() == 2); - CPPUNIT_ASSERT (aArray.size() == 1); -} diff --git a/src/ClientDelayConfig.h b/src/ClientDelayConfig.h index d48f93d600..9acfc140cf 100644 --- a/src/ClientDelayConfig.h +++ b/src/ClientDelayConfig.h @@ -1,7 +1,8 @@ #ifndef SQUID_CLIENTDELAYCONFIG_H #define SQUID_CLIENTDELAYCONFIG_H -#include "Array.h" +#include "base/Vector.h" + class StoreEntry; class acl_access; class ConfigParser; diff --git a/src/ConfigOption.h b/src/ConfigOption.h index f881ce00ef..2016eb6b7f 100644 --- a/src/ConfigOption.h +++ b/src/ConfigOption.h @@ -30,8 +30,7 @@ #ifndef SQUID_CONFIGOPTION_H #define SQUID_CONFIGOPTION_H -/* for Vector<> */ -#include "Array.h" +#include "base/Vector.h" class StoreEntry; diff --git a/src/CpuAffinityMap.h b/src/CpuAffinityMap.h index 4fc062468c..d322573f3d 100644 --- a/src/CpuAffinityMap.h +++ b/src/CpuAffinityMap.h @@ -4,7 +4,7 @@ #ifndef SQUID_CPU_AFFINITY_MAP_H #define SQUID_CPU_AFFINITY_MAP_H -#include "Array.h" +#include "base/Vector.h" class CpuAffinitySet; diff --git a/src/DelayPools.h b/src/DelayPools.h index 534e561ed1..f7748e262a 100644 --- a/src/DelayPools.h +++ b/src/DelayPools.h @@ -32,6 +32,12 @@ #ifndef SQUID_DELAYPOOLS_H #define SQUID_DELAYPOOLS_H +#include "base/Vector.h" + +class DelayPool; +class Updateable; +class StoreEntry; + /** \defgroup DelayPoolsAPI Delay Pools API \ingroup Components @@ -47,14 +53,6 @@ public: virtual void update(int) = 0; }; -/* forward decls */ -class DelayPool; -class Updateable; -class StoreEntry; - -/* for Vector<> */ -#include "Array.h" - /// \ingroup DelayPoolsAPI class DelayPools { diff --git a/src/DelayTagged.h b/src/DelayTagged.h index e0a9772bee..342506c289 100644 --- a/src/DelayTagged.h +++ b/src/DelayTagged.h @@ -41,7 +41,7 @@ #include "DelayIdComposite.h" #include "DelayBucket.h" #include "DelaySpec.h" -#include "Array.h" +#include "base/Vector.h" #include "splay.h" /// \ingroup DelayPoolsAPI diff --git a/src/DelayUser.h b/src/DelayUser.h index 205fb40948..885cbbd198 100644 --- a/src/DelayUser.h +++ b/src/DelayUser.h @@ -42,7 +42,7 @@ #include "DelayIdComposite.h" #include "DelayBucket.h" #include "DelaySpec.h" -#include "Array.h" +#include "base/Vector.h" #include "splay.h" /// \ingroup DelayPoolsAPI diff --git a/src/DiskIO/DiskIOModule.h b/src/DiskIO/DiskIOModule.h index ca301e331c..b8d18a0970 100644 --- a/src/DiskIO/DiskIOModule.h +++ b/src/DiskIO/DiskIOModule.h @@ -32,7 +32,7 @@ #ifndef SQUID_DISKIOMODULE_H #define SQUID_DISKIOMODULE_H -#include "Array.h" +#include "base/Vector.h" /* forward decls */ diff --git a/src/EventLoop.h b/src/EventLoop.h index 63736ddd94..fe26776065 100644 --- a/src/EventLoop.h +++ b/src/EventLoop.h @@ -31,7 +31,7 @@ #ifndef SQUID_EVENTLOOP_H #define SQUID_EVENTLOOP_H -#include "Array.h" +#include "base/Vector.h" #define EVENT_LOOP_TIMEOUT 1000 /* 1s timeout */ diff --git a/src/FadingCounter.h b/src/FadingCounter.h index 99f9492d08..9430ef14f6 100644 --- a/src/FadingCounter.h +++ b/src/FadingCounter.h @@ -1,7 +1,7 @@ #ifndef SQUID_FADING_COUNTER_H #define SQUID_FADING_COUNTER_H -#include "Array.h" +#include "base/Vector.h" /// Counts events, forgetting old ones. Usefull for "3 errors/minute" limits. class FadingCounter diff --git a/src/HttpHeaderRange.h b/src/HttpHeaderRange.h index d1dec803bf..0a66b83d06 100644 --- a/src/HttpHeaderRange.h +++ b/src/HttpHeaderRange.h @@ -32,7 +32,7 @@ #ifndef SQUID_HTTPHEADERRANGE_H #define SQUID_HTTPHEADERRANGE_H -#include "Array.h" +#include "base/Vector.h" #include "MemPool.h" #include "Packer.h" #include "Range.h" diff --git a/src/Makefile.am b/src/Makefile.am index d8c141ca7b..17742fbf49 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1090,6 +1090,7 @@ check_PROGRAMS+=\ tests/testURL \ tests/testConfigParser \ tests/testStatHist \ + tests/testVector \ $(STORE_TESTS) ## NP: required to run the above list. check_PROGRAMS only builds the binaries... @@ -3868,6 +3869,21 @@ tests_testStatHist_LDADD = \ $(COMPAT_LIB) tests_testStatHist_DEPENDENCIES = $(SQUID_CPPUNIT_LA) +tests_testVector_SOURCES = \ + tests/testVector.cc \ + tests/testMain.cc \ + tests/testVector.h \ + time.cc +nodist_tests_testVector_SOURCES = \ + $(TESTSOURCES) +tests_testVector_LDADD= \ + $(SQUID_CPPUNIT_LIBS) \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) +tests_testVector_LDFLAGS = $(LIBADD_DL) +tests_testVector_DEPENDENCIES = \ + $(SQUID_CPPUNIT_LA) + TESTS += testHeaders diff --git a/src/Notes.h b/src/Notes.h index 860eaaaa59..daa576864b 100644 --- a/src/Notes.h +++ b/src/Notes.h @@ -1,7 +1,7 @@ #ifndef SQUID_NOTES_H #define SQUID_NOTES_H -#include "Array.h" +#include "base/Vector.h" #include "base/RefCount.h" #include "CbDataList.h" #include "MemPool.h" diff --git a/src/PeerSelectState.h b/src/PeerSelectState.h index 1e694c8e28..1ad666d4bd 100644 --- a/src/PeerSelectState.h +++ b/src/PeerSelectState.h @@ -34,7 +34,7 @@ #define SQUID_PEERSELECTSTATE_H #include "acl/Checklist.h" -#include "Array.h" +#include "base/Vector.h" #include "cbdata.h" #include "comm/forward.h" #include "hier_code.h" diff --git a/src/StoreFileSystem.h b/src/StoreFileSystem.h index 18b683b759..a83b848415 100644 --- a/src/StoreFileSystem.h +++ b/src/StoreFileSystem.h @@ -31,7 +31,7 @@ #ifndef SQUID_STOREFILESYSTEM_H #define SQUID_STOREFILESYSTEM_H -#include "Array.h" +#include "base/Vector.h" /* ****** DOCUMENTATION ***** */ diff --git a/src/acl/Acl.h b/src/acl/Acl.h index e7ae5af6f3..4c8613fbf8 100644 --- a/src/acl/Acl.h +++ b/src/acl/Acl.h @@ -33,7 +33,7 @@ #ifndef SQUID_ACL_H #define SQUID_ACL_H -#include "Array.h" +#include "base/Vector.h" #include "cbdata.h" #include "defines.h" #include "dlink.h" diff --git a/src/adaptation/Config.cc b/src/adaptation/Config.cc index a5edde2dec..2908a4101b 100644 --- a/src/adaptation/Config.cc +++ b/src/adaptation/Config.cc @@ -36,7 +36,7 @@ #include "adaptation/History.h" #include "adaptation/Service.h" #include "adaptation/ServiceGroups.h" -#include "Array.h" +#include "base/Vector.h" #include "ConfigParser.h" #include "globals.h" #include "HttpReply.h" diff --git a/src/adaptation/DynamicGroupCfg.h b/src/adaptation/DynamicGroupCfg.h index a2ec4b61d4..8f70ee4bf4 100644 --- a/src/adaptation/DynamicGroupCfg.h +++ b/src/adaptation/DynamicGroupCfg.h @@ -1,7 +1,7 @@ #ifndef SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H #define SQUID_ADAPTATION__DYNAMIC_GROUP_CFG_H -#include "Array.h" +#include "base/Vector.h" #include "SquidString.h" namespace Adaptation diff --git a/src/adaptation/History.h b/src/adaptation/History.h index c2fe8f1434..07b3cf312f 100644 --- a/src/adaptation/History.h +++ b/src/adaptation/History.h @@ -2,7 +2,7 @@ #define SQUID_ADAPT_HISTORY_H #include "adaptation/DynamicGroupCfg.h" -#include "Array.h" +#include "base/Vector.h" #include "base/RefCount.h" #include "HttpHeader.h" #include "Notes.h" diff --git a/src/adaptation/ServiceGroups.h b/src/adaptation/ServiceGroups.h index 043bb74e69..0fdaf80341 100644 --- a/src/adaptation/ServiceGroups.h +++ b/src/adaptation/ServiceGroups.h @@ -2,7 +2,7 @@ #define SQUID_ADAPTATION__SERVICE_GROUPS_H #include "SquidString.h" -#include "Array.h" +#include "base/Vector.h" #include "adaptation/Elements.h" #include "adaptation/forward.h" #include "base/RefCount.h" diff --git a/src/adaptation/icap/Config.cc b/src/adaptation/icap/Config.cc index b7879fbff2..3e2288e0c7 100644 --- a/src/adaptation/icap/Config.cc +++ b/src/adaptation/icap/Config.cc @@ -33,7 +33,7 @@ #include "squid.h" #include "ConfigParser.h" #include "Store.h" -#include "Array.h" +#include "base/Vector.h" #include "adaptation/icap/Config.h" #include "adaptation/icap/ServiceRep.h" #include "HttpRequest.h" diff --git a/src/auth/Scheme.h b/src/auth/Scheme.h index 8a677eb5b9..1f2ed38aba 100644 --- a/src/auth/Scheme.h +++ b/src/auth/Scheme.h @@ -33,7 +33,7 @@ #if USE_AUTH -#include "Array.h" +#include "base/Vector.h" #include "base/RefCount.h" /** diff --git a/src/base/Makefile.am b/src/base/Makefile.am index 23ca7e0e2c..fa87fc16fb 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -22,4 +22,6 @@ libbase_la_SOURCES = \ Subscription.h \ TextException.cc \ TextException.h \ - StringArea.h + StringArea.h \ + Vector.cc \ + Vector.h diff --git a/lib/Array.cc b/src/base/Vector.cc similarity index 98% rename from lib/Array.cc rename to src/base/Vector.cc index 967864a9a4..afc420aec9 100644 --- a/lib/Array.cc +++ b/src/base/Vector.cc @@ -38,7 +38,7 @@ */ #include "squid.h" -#include "Array.h" +#include "base/Vector.h" #if HAVE_ASSERT_H #include diff --git a/include/Array.h b/src/base/Vector.h similarity index 100% rename from include/Array.h rename to src/base/Vector.h diff --git a/src/comm/AcceptLimiter.h b/src/comm/AcceptLimiter.h index a31d96af25..50689efaed 100644 --- a/src/comm/AcceptLimiter.h +++ b/src/comm/AcceptLimiter.h @@ -1,7 +1,7 @@ #ifndef _SQUID_SRC_COMM_ACCEPT_LIMITER_H #define _SQUID_SRC_COMM_ACCEPT_LIMITER_H -#include "Array.h" +#include "base/Vector.h" #include "comm/TcpAcceptor.h" namespace Comm diff --git a/src/comm/forward.h b/src/comm/forward.h index 2d5a5031f0..104d7a7820 100644 --- a/src/comm/forward.h +++ b/src/comm/forward.h @@ -1,7 +1,7 @@ #ifndef _SQUID_COMM_FORWARD_H #define _SQUID_COMM_FORWARD_H -#include "Array.h" +#include "base/Vector.h" #include "base/RefCount.h" namespace Comm diff --git a/src/delay_pools.cc b/src/delay_pools.cc index a979d94e35..a5fd963ebc 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -42,7 +42,7 @@ #include "squid.h" #if USE_DELAY_POOLS -#include "Array.h" +#include "base/Vector.h" #include "client_side_request.h" #include "comm/Connection.h" #include "CommonPool.h" diff --git a/src/esi/CustomParser.cc b/src/esi/CustomParser.cc index 4f1c0835f5..4f1cc56fee 100644 --- a/src/esi/CustomParser.cc +++ b/src/esi/CustomParser.cc @@ -32,7 +32,7 @@ */ #include "squid.h" -#include "Array.h" +#include "base/Vector.h" #include "esi/CustomParser.h" #include "Debug.h" #include "Trie.h" diff --git a/src/esi/VarState.h b/src/esi/VarState.h index 4101d3d08e..5c632bcdce 100644 --- a/src/esi/VarState.h +++ b/src/esi/VarState.h @@ -34,7 +34,7 @@ #include "esi/Segment.h" #include "Trie.h" -#include "Array.h" +#include "base/Vector.h" #include "HttpHeader.h" class HttpReply; diff --git a/src/event.h b/src/event.h index aa269292a2..e35460d448 100644 --- a/src/event.h +++ b/src/event.h @@ -32,7 +32,7 @@ #ifndef SQUID_EVENT_H #define SQUID_EVENT_H -#include "Array.h" +#include "base/Vector.h" #include "AsyncEngine.h" #include "MemPool.h" diff --git a/src/forward.h b/src/forward.h index dd59ac577d..22eadbfb76 100644 --- a/src/forward.h +++ b/src/forward.h @@ -1,7 +1,7 @@ #ifndef SQUID_FORWARD_H #define SQUID_FORWARD_H -#include "Array.h" +#include "base/Vector.h" #include "base/RefCount.h" #include "comm.h" #include "comm/Connection.h" diff --git a/src/ipc/Coordinator.h b/src/ipc/Coordinator.h index 91a45372d5..69631380a6 100644 --- a/src/ipc/Coordinator.h +++ b/src/ipc/Coordinator.h @@ -6,7 +6,7 @@ #ifndef SQUID_IPC_COORDINATOR_H #define SQUID_IPC_COORDINATOR_H -#include "Array.h" +#include "base/Vector.h" #include "ipc/Messages.h" #include "ipc/Port.h" #include "ipc/SharedListen.h" diff --git a/src/ipc/Kids.h b/src/ipc/Kids.h index a0519a7884..2263189b60 100644 --- a/src/ipc/Kids.h +++ b/src/ipc/Kids.h @@ -4,7 +4,7 @@ #ifndef SQUID_IPC_KIDS_H #define SQUID_IPC_KIDS_H -#include "Array.h" +#include "base/Vector.h" #include "ipc/Kid.h" /// a collection of kids diff --git a/src/ipc/Queue.h b/src/ipc/Queue.h index 8311a13a35..6c2fecd8b7 100644 --- a/src/ipc/Queue.h +++ b/src/ipc/Queue.h @@ -4,7 +4,7 @@ #ifndef SQUID_IPC_QUEUE_H #define SQUID_IPC_QUEUE_H -#include "Array.h" +#include "base/Vector.h" #include "Debug.h" #include "base/InstanceId.h" #include "ipc/AtomicWord.h" diff --git a/src/tests/testVector.cc b/src/tests/testVector.cc new file mode 100644 index 0000000000..430f04190f --- /dev/null +++ b/src/tests/testVector.cc @@ -0,0 +1,19 @@ +#define SQUID_UNIT_TEST 1 +#include "squid.h" +#include "base/Vector.h" +#include "tests/testVector.h" + +#include + +CPPUNIT_TEST_SUITE_REGISTRATION( testVector ); + +void testVector::all() +{ + CPPUNIT_ASSERT( 1 == 1 ); + Vector aArray; + CPPUNIT_ASSERT(aArray.size() == 0); + aArray.push_back(2); + CPPUNIT_ASSERT(aArray.size() == 1); + CPPUNIT_ASSERT(aArray.back() == 2); + CPPUNIT_ASSERT(aArray.size() == 1); +} diff --git a/lib/tests/testArray.h b/src/tests/testVector.h similarity index 59% rename from lib/tests/testArray.h rename to src/tests/testVector.h index 4b0ddbdb27..f1606db217 100644 --- a/lib/tests/testArray.h +++ b/src/tests/testVector.h @@ -1,6 +1,5 @@ - -#ifndef SQUID_LIB_TEST_ARRAY_H -#define SQUID_LIB_TEST_ARRAY_H +#ifndef SQUID_SRC_TESTS_TESTVECTOR_H +#define SQUID_SRC_TESTS_TESTVECTOR_H #include @@ -10,9 +9,9 @@ * */ -class testArray : public CPPUNIT_NS::TestFixture +class testVector : public CPPUNIT_NS::TestFixture { - CPPUNIT_TEST_SUITE( testArray ); + CPPUNIT_TEST_SUITE( testVector ); CPPUNIT_TEST( all ); CPPUNIT_TEST_SUITE_END(); @@ -23,4 +22,3 @@ protected: }; #endif - diff --git a/src/tunnel.cc b/src/tunnel.cc index ed75442cf7..af4711824c 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -33,7 +33,7 @@ #include "squid.h" #include "acl/FilledChecklist.h" -#include "Array.h" +#include "base/Vector.h" #include "CachePeer.h" #include "client_side_request.h" #include "client_side.h"