From: Francesco Chemolli Date: Sat, 1 Sep 2012 20:23:30 +0000 (+0200) Subject: Removed useless struct ushortlist X-Git-Tag: sourceformat-review-1~6^2~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=efdc32f4f1c6a30be5b118d6b36712c6fd809bc7;p=thirdparty%2Fsquid.git Removed useless struct ushortlist turned some structs into classes --- diff --git a/src/PeerDigest.h b/src/PeerDigest.h index b6b9025a0a..af342bf111 100644 --- a/src/PeerDigest.h +++ b/src/PeerDigest.h @@ -59,7 +59,8 @@ public: int reserved[32 - 6]; }; -struct _DigestFetchState { +class DigestFetchState { +public: PeerDigest *pd; StoreEntry *entry; StoreEntry *old_entry; diff --git a/src/mgr/IoAction.cc b/src/mgr/IoAction.cc index 82b673bc32..421a903e1f 100644 --- a/src/mgr/IoAction.cc +++ b/src/mgr/IoAction.cc @@ -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; diff --git a/src/mgr/IoAction.h b/src/mgr/IoAction.h index ff0c998257..0925a2c596 100644 --- a/src/mgr/IoAction.h +++ b/src/mgr/IoAction.h @@ -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 diff --git a/src/neighbors.cc b/src/neighbors.cc index e8dc8cd2c6..a8a4bc9f06 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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; diff --git a/src/stat.cc b/src/stat.cc index 830da56d70..4781a027e8 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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, diff --git a/src/structs.h b/src/structs.h index 8352e2a524..1509abb4d4 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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; diff --git a/src/typedefs.h b/src/typedefs.h index b789d2d9c9..da64b8b358 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -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;