From 22056ef8370e618dea14c5e983ecdaf9df06730d Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 7 Jan 2017 16:10:12 +1300 Subject: [PATCH] Cleanup: Remove HttpHdrCc.cci file Moving the simple methods inline to the HttpHdrCc.h and more complicated setter to HttpHdrCc.cc. --- src/HttpHdrCc.cc | 23 +++++++++++++++++++---- src/HttpHdrCc.cci | 48 ----------------------------------------------- src/HttpHdrCc.h | 23 ++++++++++++++--------- src/Makefile.am | 12 ------------ 4 files changed, 33 insertions(+), 73 deletions(-) delete mode 100644 src/HttpHdrCc.cci diff --git a/src/HttpHdrCc.cc b/src/HttpHdrCc.cc index bb740aa4db..34ddd4628f 100644 --- a/src/HttpHdrCc.cc +++ b/src/HttpHdrCc.cc @@ -71,6 +71,25 @@ HttpHdrCc::clear() *this=HttpHdrCc(); } +/// set a data member to a new value, and set the corresponding mask-bit. +/// if setting is false, then the mask-bit is cleared. +void +HttpHdrCc::setValue(int32_t &value, int32_t new_value, HttpHdrCcType hdr, bool setting) +{ + if (setting) { + if (new_value < 0) { + debugs(65, 3, "rejecting negative-value Cache-Control directive " << hdr + << " value " << new_value); + return; + } + } else { + new_value = -1; //rely on the convention that "unknown" is -1 + } + + value = new_value; + setMask(hdr,setting); +} + bool HttpHdrCc::parse(const String & str) { @@ -331,7 +350,3 @@ operator<< (std::ostream &s, HttpHdrCcType c) return s; } -#if !_USE_INLINE_ -#include "HttpHdrCc.cci" -#endif - diff --git a/src/HttpHdrCc.cci b/src/HttpHdrCc.cci deleted file mode 100644 index cdbc1016f0..0000000000 --- a/src/HttpHdrCc.cci +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 1996-2017 The Squid Software Foundation and contributors - * - * Squid software is distributed under GPLv2+ license and includes - * contributions from numerous individuals and organizations. - * Please see the COPYING and CONTRIBUTORS files for details. - */ - -/* DEBUG: section 65 HTTP Cache Control Header */ - -#include "Debug.h" -#include "defines.h" - -bool -HttpHdrCc::isSet(HttpHdrCcType id) const -{ - assert(id < HttpHdrCcType::CC_ENUM_END); - return EBIT_TEST(mask, static_cast(id)); -} - -void -HttpHdrCc::setMask(HttpHdrCcType id, bool newval) -{ - if (newval) - EBIT_SET(mask,static_cast(id)); - else - EBIT_CLR(mask, static_cast(id)); -} - -/// set a data member to a new value, and set the corresponding mask-bit. -/// if setting is false, then the mask-bit is cleared. -void -HttpHdrCc::setValue(int32_t &value, int32_t new_value, HttpHdrCcType hdr, bool setting) -{ - if (setting) { - if (new_value < 0) { - debugs(65,3,HERE << "rejecting negative-value Cache-Control directive " << hdr - << " value " << new_value ); - return; - } - } else { - new_value=-1; //rely on the convention that "unknown" is -1 - } - - value=new_value; - setMask(hdr,setting); -} - diff --git a/src/HttpHdrCc.h b/src/HttpHdrCc.h index cfeb55e270..6672e59063 100644 --- a/src/HttpHdrCc.h +++ b/src/HttpHdrCc.h @@ -9,6 +9,7 @@ #ifndef SQUID_HTTPHDRCC_H #define SQUID_HTTPHDRCC_H +#include "defines.h" #include "dlink.h" #include "mem/forward.h" #include "SquidString.h" @@ -167,7 +168,10 @@ public: void clearImmutable() {setMask(HttpHdrCcType::CC_IMMUTABLE,false);} /// check whether the attribute value supplied by id is set - _SQUID_INLINE_ bool isSet(HttpHdrCcType id) const; + bool isSet(HttpHdrCcType id) const { + assert(id < HttpHdrCcType::CC_ENUM_END); + return EBIT_TEST(mask, static_cast(id)); + } void packInto(Packable * p) const; @@ -187,8 +191,14 @@ private: String no_cache; ///< List of headers sent as value for CC:no-cache="...". May be empty/undefined if the value is missing. /// low-level part of the public set method, performs no checks - _SQUID_INLINE_ void setMask(HttpHdrCcType id, bool newval=true); - _SQUID_INLINE_ void setValue(int32_t &value, int32_t new_value, HttpHdrCcType hdr, bool setting=true); + void setMask(HttpHdrCcType id, bool newval=true) { + if (newval) + EBIT_SET(mask,static_cast(id)); + else + EBIT_CLR(mask, static_cast(id)); + } + + void setValue(int32_t &value, int32_t new_value, HttpHdrCcType hdr, bool setting=true); public: /**comma-separated representation of the header values which were @@ -204,12 +214,7 @@ void httpHdrCcInitModule(void); void httpHdrCcUpdateStats(const HttpHdrCc * cc, StatHist * hist); void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); -std::ostream& -operator<< (std::ostream &, HttpHdrCcType); - -#if _USE_INLINE_ -#include "HttpHdrCc.cci" -#endif +std::ostream & operator<< (std::ostream &, HttpHdrCcType); #endif /* SQUID_HTTPHDRCC_H */ diff --git a/src/Makefile.am b/src/Makefile.am index ace10596c5..1239d6dfa3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -317,7 +317,6 @@ squid_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrRange.cc \ HttpHdrSc.cc \ HttpHdrSc.h \ @@ -931,7 +930,6 @@ tests_testHttpReply_SOURCES=\ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrContRange.h \ HttpHdrRange.cc \ @@ -1046,7 +1044,6 @@ tests_testACLMaxUserIP_SOURCES= \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ HttpMsg.cc \ @@ -1273,7 +1270,6 @@ tests_testCacheManager_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ @@ -1457,7 +1453,6 @@ tests_testDiskIO_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ @@ -1693,7 +1688,6 @@ tests_testEvent_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ @@ -1930,7 +1924,6 @@ tests_testEventLoop_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ @@ -2157,7 +2150,6 @@ tests_test_http_range_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ @@ -2478,7 +2470,6 @@ tests_testHttpRequest_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ @@ -2708,7 +2699,6 @@ tests_testStore_SOURCES= \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ @@ -3003,7 +2993,6 @@ tests_testUfs_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ @@ -3316,7 +3305,6 @@ tests_testURL_SOURCES = \ HttpHeaderFieldStat.h \ HttpHdrCc.h \ HttpHdrCc.cc \ - HttpHdrCc.cci \ HttpHdrContRange.cc \ HttpHdrRange.cc \ HttpHdrSc.cc \ -- 2.47.2