]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed useless struct ushortlist
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 1 Sep 2012 20:23:30 +0000 (22:23 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 1 Sep 2012 20:23:30 +0000 (22:23 +0200)
turned some structs into classes

src/PeerDigest.h
src/mgr/IoAction.cc
src/mgr/IoAction.h
src/neighbors.cc
src/stat.cc
src/structs.h
src/typedefs.h

index b6b9025a0a351e3714e0c3ae53a5e2a631ce67db..af342bf1117279e12784e1da388d617d55378770 100644 (file)
@@ -59,7 +59,8 @@ public:
     int reserved[32 - 6];
 };
 
-struct _DigestFetchState {
+class DigestFetchState {
+public:
     PeerDigest *pd;
     StoreEntry *entry;
     StoreEntry *old_entry;
index 82b673bc32adeec868999967065063381bf1de7b..421a903e1fb007da124e1fc7a6c640e6c486f626 100644 (file)
@@ -24,13 +24,13 @@ Mgr::IoActionData&
 Mgr::IoActionData::operator += (const IoActionData& stats)
 {
     http_reads += stats.http_reads;
-    for (int i = 0; i < _iostats::histSize; ++i)
+    for (int i = 0; i < iostats::histSize; ++i)
         http_read_hist[i] += stats.http_read_hist[i];
     ftp_reads += stats.ftp_reads;
-    for (int i = 0; i < _iostats::histSize; ++i)
+    for (int i = 0; i < iostats::histSize; ++i)
         ftp_read_hist[i] += stats.ftp_read_hist[i];
     gopher_reads += stats.gopher_reads;
-    for (int i = 0; i < _iostats::histSize; ++i)
+    for (int i = 0; i < iostats::histSize; ++i)
         gopher_read_hist[i] += stats.gopher_read_hist[i];
 
     return *this;
index ff0c998257fdef7020dcdbed90d6830fdc750766..0925a2c59642cc77dd3737fe33a826f35254c0a5 100644 (file)
@@ -7,7 +7,7 @@
 #define SQUID_MGR_IO_ACTION_H
 
 #include "mgr/Action.h"
-#include "structs.h" /* _iostats::histSize */
+#include "structs.h" /* iostats::histSize */
 
 namespace Mgr
 {
@@ -23,9 +23,9 @@ public:
     double http_reads;
     double ftp_reads;
     double gopher_reads;
-    double http_read_hist[_iostats::histSize];
-    double ftp_read_hist[_iostats::histSize];
-    double gopher_read_hist[_iostats::histSize];
+    double http_read_hist[iostats::histSize];
+    double ftp_read_hist[iostats::histSize];
+    double gopher_read_hist[iostats::histSize];
 };
 
 /// implement aggregated 'io' action
index e8dc8cd2c638051bf9606cf043c5ae335ebf723e..a8a4bc9f066fad886fc1936ebf4ba1ecc5e5a4b0 100644 (file)
@@ -129,7 +129,7 @@ peer_t
 neighborType(const peer * p, const HttpRequest * request)
 {
 
-    const struct _domain_type *d = NULL;
+    const domain_type *d = NULL;
 
     for (d = p->typelist; d; d = d->next) {
         if (0 == matchDomainName(request->GetHost(), d->domain))
@@ -152,7 +152,7 @@ bool
 peerAllowedToUse(const peer * p, HttpRequest * request)
 {
 
-    const struct _domain_ping *d = NULL;
+    const domain_ping *d = NULL;
     assert(request != NULL);
 
     if (neighborType(p, request) == PEER_SIBLING) {
@@ -1169,9 +1169,9 @@ peerDestroy(void *data)
     if (p == NULL)
         return;
 
-    struct _domain_ping *nl = NULL;
+    domain_ping *nl = NULL;
 
-    for (struct _domain_ping *l = p->peer_domain; l; l = nl) {
+    for (domain_ping *l = p->peer_domain; l; l = nl) {
         nl = l->next;
         safe_free(l->domain);
         xfree(l);
@@ -1591,7 +1591,7 @@ dump_peers(StoreEntry * sentry, peer * peers)
 {
     peer *e = NULL;
     char ntoabuf[MAX_IPSTRLEN];
-    struct _domain_ping *d = NULL;
+    domain_ping *d = NULL;
     icp_opcode op;
     int i;
 
index 830da56d70682cf9168156602b5148356838309c..4781a027e8c99f2032e028735d44960c390c60c0 100644 (file)
@@ -219,19 +219,19 @@ GetIoStats(Mgr::IoActionData& stats)
 
     stats.http_reads = IOStats.Http.reads;
 
-    for (i = 0; i < _iostats::histSize; ++i) {
+    for (i = 0; i < iostats::histSize; ++i) {
         stats.http_read_hist[i] = IOStats.Http.read_hist[i];
     }
 
     stats.ftp_reads = IOStats.Ftp.reads;
 
-    for (i = 0; i < _iostats::histSize; ++i) {
+    for (i = 0; i < iostats::histSize; ++i) {
         stats.ftp_read_hist[i] = IOStats.Ftp.read_hist[i];
     }
 
     stats.gopher_reads = IOStats.Gopher.reads;
 
-    for (i = 0; i < _iostats::histSize; ++i) {
+    for (i = 0; i < iostats::histSize; ++i) {
         stats.gopher_read_hist[i] = IOStats.Gopher.read_hist[i];
     }
 }
@@ -245,7 +245,7 @@ DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry)
     storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.http_reads);
     storeAppendPrintf(sentry, "Read Histogram:\n");
 
-    for (i = 0; i < _iostats::histSize; ++i) {
+    for (i = 0; i < iostats::histSize; ++i) {
         storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n",
                           i ? (1 << (i - 1)) + 1 : 1,
                           1 << i,
@@ -258,7 +258,7 @@ DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry)
     storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.ftp_reads);
     storeAppendPrintf(sentry, "Read Histogram:\n");
 
-    for (i = 0; i < _iostats::histSize; ++i) {
+    for (i = 0; i < iostats::histSize; ++i) {
         storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n",
                           i ? (1 << (i - 1)) + 1 : 1,
                           1 << i,
@@ -271,7 +271,7 @@ DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry)
     storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.gopher_reads);
     storeAppendPrintf(sentry, "Read Histogram:\n");
 
-    for (i = 0; i < _iostats::histSize; ++i) {
+    for (i = 0; i < iostats::histSize; ++i) {
         storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n",
                           i ? (1 << (i - 1)) + 1 : 1,
                           1 << i,
index 8352e2a52471e50b7f5b038be185a7e9574bef60..1509abb4d4b7e77cbf8ebe6a5b970a90b99b6897 100644 (file)
@@ -113,11 +113,6 @@ struct acl_size_t {
     int64_t size;
 };
 
-struct ushortlist {
-    unsigned short i;
-    ushortlist *next;
-};
-
 struct relist {
     int flags;
     char *pattern;
@@ -662,13 +657,15 @@ struct SquidConfig2 {
 
 SQUIDCEXTERN SquidConfig2 Config2;
 
-struct _close_handler {
+class close_handler {
+public:
     PF *handler;
     void *data;
     close_handler *next;
 };
 
-struct _dread_ctrl {
+class dread_ctrl {
+public:
     int fd;
     off_t offset;
     int req_len;
@@ -678,7 +675,8 @@ struct _dread_ctrl {
     void *client_data;
 };
 
-struct _dwrite_q {
+class dwrite_q {
+public:
     off_t file_offset;
     char *buf;
     size_t len;
@@ -725,7 +723,8 @@ public:
     HttpHeaderFieldStat stat;
 };
 
-struct _http_state_flags {
+class http_state_flags {
+public:
     unsigned int proxying:1;
     unsigned int keepalive:1;
     unsigned int only_if_cached:1;
@@ -743,13 +742,15 @@ struct _http_state_flags {
     unsigned int sentLastChunk:1; ///< do not try to write last-chunk again
 };
 
-struct _domain_ping {
+class domain_ping {
+public:
     char *domain;
     int do_ping;               /* boolean */
     domain_ping *next;
 };
 
-struct _domain_type {
+class domain_type {
+public:
     char *domain;
     peer_t type;
     domain_type *next;
@@ -917,20 +918,25 @@ struct peer {
     int connection_auth;
 };
 
-struct _net_db_name {
+class netdbEntry;
+
+class net_db_name {
+public:
     hash_link hash;            /* must be first */
     net_db_name *next;
     netdbEntry *net_db_entry;
 };
 
-struct _net_db_peer {
+class net_db_peer {
+public:
     const char *peername;
     double hops;
     double rtt;
     time_t expires;
 };
 
-struct _netdbEntry {
+class netdbEntry {
+public:
     hash_link hash;            /* must be first */
     char network[MAX_IPSTRLEN];
     int pings_sent;
@@ -946,9 +952,11 @@ struct _netdbEntry {
     int n_peers;
 };
 
-struct _iostats {
+class iostats {
+public:
+    static const int histSize=16;
 
-    enum { histSize = 16 };
+//    enum { histSize = 16 };
 
     struct {
         int reads;
index b789d2d9c9fa1411c3809a30718333073b96df99..da64b8b3586d47500d80b7c3e4d6f3752436227b 100644 (file)
@@ -45,32 +45,10 @@ typedef struct {
     size_t kb;
 } kb_t;
 
-typedef struct _close_handler close_handler;
-
-typedef struct _dread_ctrl dread_ctrl;
-
-typedef struct _dwrite_q dwrite_q;
-
 typedef struct _HttpHeaderFieldAttrs HttpHeaderFieldAttrs;
 
-typedef struct _domain_ping domain_ping;
-
-typedef struct _domain_type domain_type;
-
-typedef struct _DigestFetchState DigestFetchState;
-
-typedef struct _net_db_name net_db_name;
-
-typedef struct _net_db_peer net_db_peer;
-
-typedef struct _netdbEntry netdbEntry;
-
 typedef struct _icp_common_t icp_common_t;
 
-typedef struct _iostats iostats;
-
-typedef struct _http_state_flags http_state_flags;
-
 typedef struct _header_mangler header_mangler;
 
 typedef struct _cachemgr_passwd cachemgr_passwd;