]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup macros in src/defines.h (#860)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sun, 25 Jul 2021 19:42:12 +0000 (19:42 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 25 Jul 2021 20:52:10 +0000 (20:52 +0000)
Reduce compile unit dependencies on src/defines.h by moving some
src/defines.h macros to their most-relevant header.

Also remove all src/defines.h macros known to be unused.

src/acl/TimeData.cc
src/defines.h
src/esi/Segment.h
src/globals.h
src/http/forward.h
src/mgr/StoreToCommWriter.h
src/tools.cc

index 7aee44abc137d8192b37eef17e5d5d6e1c7e0f0b..7220772293a01909e34ef120a38594b8fd2e7da1 100644 (file)
 #include "Debug.h"
 #include "wordlist.h"
 
+#define ACL_SUNDAY  0x01
+#define ACL_MONDAY  0x02
+#define ACL_TUESDAY 0x04
+#define ACL_WEDNESDAY   0x08
+#define ACL_THURSDAY    0x10
+#define ACL_FRIDAY  0x20
+#define ACL_SATURDAY    0x40
+#define ACL_ALLWEEK 0x7F
+#define ACL_WEEKDAYS    0x3E
+
 ACLTimeData::ACLTimeData () : weekbits (0), start (0), stop (0), next (NULL) {}
 
 ACLTimeData::ACLTimeData(ACLTimeData const &old) : weekbits(old.weekbits), start (old.start), stop (old.stop), next (NULL)
index cc85ccc92c1f11e8548e7ab9d1020ae5abab264f..92d9e295e095f187472d8a8a36d3ba5a86fe6a4c 100644 (file)
 #define BUFSIZ  4096            /* make unreasonable guess */
 #endif
 
-#define BROWSERNAMELEN 128
-
-#define ACL_SUNDAY  0x01
-#define ACL_MONDAY  0x02
-#define ACL_TUESDAY 0x04
-#define ACL_WEDNESDAY   0x08
-#define ACL_THURSDAY    0x10
-#define ACL_FRIDAY  0x20
-#define ACL_SATURDAY    0x40
-#define ACL_ALLWEEK 0x7F
-#define ACL_WEEKDAYS    0x3E
-
 /* Select types. */
 #define COMM_SELECT_READ   (0x1)
 #define COMM_SELECT_WRITE  (0x2)
 #define DISK_EOF                 (-2)
 #define DISK_NO_SPACE_LEFT       (-6)
 
-#define DNS_INBUF_SZ 4096
-
 #define FD_DESC_SZ      64
 
 #define FQDN_LOOKUP_IF_MISS 0x01
 #define FQDN_MAX_NAMES 5
 
-#define HTTP_REPLY_FIELD_SZ 128
-
-#define BUF_TYPE_8K     1
-#define BUF_TYPE_MALLOC 2
-
-#define ANONYMIZER_NONE     0
-#define ANONYMIZER_STANDARD 1
-#define ANONYMIZER_PARANOID 2
-
 #define USER_IDENT_SZ 64
-#define IDENT_NONE 0
-#define IDENT_PENDING 1
-#define IDENT_DONE 2
 
 #define IP_LOOKUP_IF_MISS   0x01
 
-#define MAX_MIME 4096
-
-/* Mark a neighbor cache as dead if it doesn't answer this many pings */
-#define HIER_MAX_DEFICIT  20
-
-#define ICP_FLAG_HIT_OBJ     0x80000000ul
 #define ICP_FLAG_SRC_RTT     0x40000000ul
 
 /* Version */
 #define REDIRECT_PENDING 1
 #define REDIRECT_DONE 2
 
-#define AUTHENTICATE_AV_FACTOR 1000
 /* AUTHENTICATION */
 
-#define NTLM_CHALLENGE_SZ 300
-
-#define current_stacksize(stack) ((stack)->top - (stack)->base)
-
 /* logfile status */
 #define LOG_ENABLE  1
 #define LOG_DISABLE 0
 
 #define SM_PAGE_SIZE 4096
-#define MAX_CLIENT_BUF_SZ 4096
 
 #define EBIT_SET(flag, bit)     ((void)((flag) |= ((1L<<(bit)))))
 #define EBIT_CLR(flag, bit)     ((void)((flag) &= ~((1L<<(bit)))))
 #define CBIT_CLR(mask, bit)     ((void)(CBIT_BIN(mask, bit) &= ~CBIT_BIT(bit)))
 #define CBIT_TEST(mask, bit)    (CBIT_BIN(mask, bit) & CBIT_BIT(bit))
 
-#define MAX_FILES_PER_DIR (1<<20)
-
 #define MAX_URL  8192
 #define MAX_LOGIN_SZ  128
 
 #define PEER_DEAD 0
 #define PEER_ALIVE 1
 
-#define AUTH_MSG_SZ 4096
-#define HTTP_REPLY_BUF_SZ 4096
 #define CLIENT_REQ_BUF_SZ 4096
 
-#if !defined(ERROR_BUF_SZ) && defined(MAX_URL)
-#define ERROR_BUF_SZ (MAX_URL << 2)
-#endif
-
-#if SQUID_SNMP
-#define VIEWINCLUDED    1
-#define VIEWEXCLUDED    2
-#endif
-
 #define STORE_META_OK     0x03
-#define STORE_META_DIRTY  0x04
-#define STORE_META_BAD    0x05
 
 #define IPC_NONE 0
 #define IPC_TCP_SOCKET 1
 
 #define STORE_META_KEY STORE_META_KEY_MD5
 
-#define STORE_META_TLD_START sizeof(int)+sizeof(char)
-#define STORE_META_TLD_SIZE STORE_META_TLD_START
-#define SwapMetaType(x) (char)x[0]
-#define SwapMetaSize(x) &x[sizeof(char)]
-#define SwapMetaData(x) &x[STORE_META_TLD_START]
 #define STORE_HDR_METASIZE (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(uint64_t))
 #define STORE_HDR_METASIZE_OLD (4*sizeof(time_t)+2*sizeof(uint16_t)+sizeof(size_t))
 
  */
 #define N_COUNT_HOUR_HIST (86400 * 3) / (60 * COUNT_INTERVAL)
 
-/* handy to determine the #elements in a static array */
-#define countof(arr) (sizeof(arr)/sizeof(*arr))
-
 /*
  * This many TCP connections must FAIL before we mark the
  * peer as DEAD
 #define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
 #endif
 
-#define HTTP_REQBUF_SZ  4096
-
 /* CygWin & Windows NT Port */
 #if _SQUID_WINDOWS_
 #define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
index 3fd804423dd5fd5053dbb5f4e1e8c93b8bf3fb78..74c61b1df50abfa02d967245aa0a9f6b3fa55d8e 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "base/RefCount.h"
 #include "cbdata.h"
-#include "defines.h"
+#include "http/forward.h"
 #include "SquidString.h"
 
 class ESISegment : public RefCountable
index b3230f3c9161d3a63aae94638ca429d606b82477..cb740453f3c79b3ee428a4f7a22fe520bc8b2c56 100644 (file)
@@ -18,7 +18,6 @@
 
 extern char *ConfigFile;    /* NULL */
 extern char *IcpOpcodeStr[];
-extern char tmp_error_buf[ERROR_BUF_SZ];
 extern char ThisCache[RFC2181_MAXHOSTNAMELEN << 1];
 extern char ThisCache2[RFC2181_MAXHOSTNAMELEN << 1];
 extern char config_input_line[BUFSIZ];
index c5f695d0c736ef8dbf1199912017ac9a60fa0169..cb7f4c0bf2bb54fd545e1d78ec0fdc6d8780d796 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "http/one/forward.h"
 
+#define HTTP_REQBUF_SZ  4096
+
 namespace Http
 {
 
index ac4d9d37397d5852dad60bda7d77511d89594338..d37a18c2e678ba8f0f9af018bd9148fb89ca5f84 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "base/AsyncJob.h"
 #include "comm/forward.h"
+#include "http/forward.h"
 #include "mgr/Action.h"
 #include "StoreIOBuffer.h"
 
index 00d77cc4c1ac8bba2b99b0cd33a1332af0473a36..04ea2e6c3644be3e7c4667b4e54823e7bd5e3d5a 100644 (file)
@@ -78,6 +78,8 @@ SQUIDCEXTERN int setresuid(uid_t, uid_t, uid_t);
 
 #endif /* _SQUID_LINUX */
 
+static char tmp_error_buf[32768]; /* 32KB */
+
 void
 releaseServerSockets(void)
 {
@@ -794,7 +796,7 @@ setSystemLimits(void)
         rl.rlim_cur = Squid_MaxFD;
         if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
             int xerrno = errno;
-            snprintf(tmp_error_buf, ERROR_BUF_SZ, "setrlimit: RLIMIT_NOFILE: %s", xstrerr(xerrno));
+            snprintf(tmp_error_buf, sizeof(tmp_error_buf), "setrlimit: RLIMIT_NOFILE: %s", xstrerr(xerrno));
             fatal_dump(tmp_error_buf);
         }
     }
@@ -809,7 +811,7 @@ setSystemLimits(void)
 
         if (setrlimit(RLIMIT_DATA, &rl) < 0) {
             int xerrno = errno;
-            snprintf(tmp_error_buf, ERROR_BUF_SZ, "setrlimit: RLIMIT_DATA: %s", xstrerr(xerrno));
+            snprintf(tmp_error_buf, sizeof(tmp_error_buf), "setrlimit: RLIMIT_DATA: %s", xstrerr(xerrno));
             fatal_dump(tmp_error_buf);
         }
     }
@@ -827,7 +829,7 @@ setSystemLimits(void)
 
         if (setrlimit(RLIMIT_VMEM, &rl) < 0) {
             int xerrno = errno;
-            snprintf(tmp_error_buf, ERROR_BUF_SZ, "setrlimit: RLIMIT_VMEM: %s", xstrerr(xerrno));
+            snprintf(tmp_error_buf, sizeof(tmp_error_buf), "setrlimit: RLIMIT_VMEM: %s", xstrerr(xerrno));
             fatal_dump(tmp_error_buf);
         }
     }