From 01a13aec0c97cdb950da5c41e094ca601f2fd146 Mon Sep 17 00:00:00 2001 From: hno <> Date: Mon, 14 Oct 2002 14:43:46 +0000 Subject: [PATCH] Many delay_pools variable name cleanups --- src/cache_cf.cc | 46 +++++++++++++++++++++++----------------------- src/delay_pools.cc | 17 +++++++++-------- src/ftp.cc | 8 ++++---- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 391c0993cc..234acac98c 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.418 2002/10/13 23:48:23 hno Exp $ + * $Id: cache_cf.cc,v 1.419 2002/10/14 08:43:46 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -844,22 +844,22 @@ dump_delay_pool_count(StoreEntry * entry, const char *name, delayConfig cfg) } storeAppendPrintf(entry, "%s %d\n", name, cfg.pools); for (i = 0; i < cfg.pools; i++) { - storeAppendPrintf(entry, "delay_class %d %d\n", i + 1, cfg.class[i]); + storeAppendPrintf(entry, "delay_class %d %d\n", i + 1, cfg.delay_class[i]); snprintf(nom, 32, "delay_access %d", i + 1); dump_acl_access(entry, nom, cfg.access[i]); - if (cfg.class[i] >= 1) + if (cfg.delay_class[i] >= 1) storeAppendPrintf(entry, "delay_parameters %d %d/%d", i + 1, cfg.rates[i]->aggregate.restore_bps, cfg.rates[i]->aggregate.max_bytes); - if (cfg.class[i] >= 3) + if (cfg.delay_class[i] >= 3) storeAppendPrintf(entry, " %d/%d", cfg.rates[i]->network.restore_bps, cfg.rates[i]->network.max_bytes); - if (cfg.class[i] >= 2) + if (cfg.delay_class[i] >= 2) storeAppendPrintf(entry, " %d/%d", cfg.rates[i]->individual.restore_bps, cfg.rates[i]->individual.max_bytes); - if (cfg.class[i] >= 1) + if (cfg.delay_class[i] >= 1) storeAppendPrintf(entry, "\n"); } } @@ -874,25 +874,25 @@ parse_delay_pool_count(delayConfig * cfg) parse_ushort(&cfg->pools); if (cfg->pools) { delayInitDelayData(cfg->pools); - cfg->delay_class = xcalloc(cfg->pools, sizeof(u_char)); - cfg->rates = xcalloc(cfg->pools, sizeof(delaySpecSet *)); - cfg->access = xcalloc(cfg->pools, sizeof(acl_access *)); + cfg->delay_class = (unsigned char *)xcalloc(cfg->pools, sizeof(unsigned char)); + cfg->rates = (delaySpecSet **)xcalloc(cfg->pools, sizeof(delaySpecSet *)); + cfg->access = (acl_access **)xcalloc(cfg->pools, sizeof(acl_access *)); } } static void parse_delay_pool_class(delayConfig * cfg) { - ushort pool, class; + ushort pool, delay_class; parse_ushort(&pool); if (pool < 1 || pool > cfg->pools) { debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d not in 1 .. %d\n", pool, cfg->pools); return; } - parse_ushort(&class); - if (class < 1 || class > 3) { - debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 3\n", pool, class); + parse_ushort(&delay_class); + if (delay_class < 1 || delay_class > 3) { + debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 3\n", pool, delay_class); return; } pool--; @@ -900,20 +900,20 @@ parse_delay_pool_class(delayConfig * cfg) delayFreeDelayPool(pool); safe_free(cfg->rates[pool]); } - cfg->rates[pool] = xmalloc(class * sizeof(delaySpec)); - cfg->delay_class[pool] = class; + cfg->rates[pool] = (delaySpecSet *)xmalloc(delay_class * sizeof(delaySpecSet)); + cfg->delay_class[pool] = delay_class; cfg->rates[pool]->aggregate.restore_bps = cfg->rates[pool]->aggregate.max_bytes = -1; if (cfg->delay_class[pool] >= 3) cfg->rates[pool]->network.restore_bps = cfg->rates[pool]->network.max_bytes = -1; if (cfg->delay_class[pool] >= 2) cfg->rates[pool]->individual.restore_bps = cfg->rates[pool]->individual.max_bytes = -1; - delayCreateDelayPool(pool, class); + delayCreateDelayPool(pool, delay_class); } static void parse_delay_pool_rates(delayConfig * cfg) { - ushort pool, class; + ushort pool, delay_class; int i; delaySpec *ptr; char *token; @@ -924,14 +924,14 @@ parse_delay_pool_rates(delayConfig * cfg) return; } pool--; - class = cfg->delay_class[pool]; - if (class == 0) { + delay_class = cfg->delay_class[pool]; + if (delay_class == 0) { debug(3, 0) ("parse_delay_pool_rates: Ignoring pool %d attempt to set rates with class not set\n", pool + 1); return; } ptr = (delaySpec *) cfg->rates[pool]; /* read in "class" sets of restore,max pairs */ - while (class--) { + while (delay_class--) { token = strtok(NULL, "/"); if (token == NULL) self_destruct(); @@ -942,9 +942,9 @@ parse_delay_pool_rates(delayConfig * cfg) ptr->max_bytes = i; ptr++; } - class = cfg->delay_class[pool]; + delay_class = cfg->delay_class[pool]; /* if class is 3, swap around network and individual */ - if (class == 3) { + if (delay_class == 3) { delaySpec tmp; tmp = cfg->rates[pool]->individual; @@ -952,7 +952,7 @@ parse_delay_pool_rates(delayConfig * cfg) cfg->rates[pool]->network = tmp; } /* initialize the delay pools */ - delayInitDelayPool(pool, class, cfg->rates[pool]); + delayInitDelayPool(pool, delay_class, cfg->rates[pool]); } static void diff --git a/src/delay_pools.cc b/src/delay_pools.cc index 7c35e4d221..2c46cdd24d 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.cc,v 1.28 2002/10/14 07:35:45 hno Exp $ + * $Id: delay_pools.cc,v 1.29 2002/10/14 08:43:46 hno Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: David Luyer @@ -38,6 +38,7 @@ #if DELAY_POOLS #include "squid.h" #include "StoreClient.h" +#include "Store.h" struct _class1DelayPool { int delay_class; @@ -144,7 +145,7 @@ delayInitDelayData(unsigned short pools) { if (!pools) return; - delay_data = xcalloc(pools, sizeof(*delay_data)); + delay_data = (delayPool *)xcalloc(pools, sizeof(*delay_data)); memory_used += pools * sizeof(*delay_data); eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1); delay_id_ptr_hash = hash_create(delayIdPtrHashCmp, 256, delayIdPtrHash); @@ -153,7 +154,7 @@ delayInitDelayData(unsigned short pools) static void delayIdZero(void *hlink) { - hash_link *h = hlink; + hash_link *h = (hash_link *)hlink; delay_id *id = (delay_id *) h->key; *id = 0; xfree(h); @@ -180,7 +181,7 @@ delayRegisterDelayIdPtr(delay_id * loc) return; if (*loc == 0) return; - lnk = xmalloc(sizeof(hash_link)); + lnk = (hash_link *)xmalloc(sizeof(hash_link)); memory_used += sizeof(hash_link); lnk->key = (char *) loc; hash_join(delay_id_ptr_hash, lnk); @@ -199,7 +200,7 @@ delayUnregisterDelayIdPtr(delay_id * loc) */ if (*loc == 0) return; - lnk = hash_lookup(delay_id_ptr_hash, loc); + lnk = (hash_link *)hash_lookup(delay_id_ptr_hash, loc); assert(lnk); hash_remove_link(delay_id_ptr_hash, lnk); xxfree(lnk); @@ -211,17 +212,17 @@ delayCreateDelayPool(unsigned short pool, u_char delay_class) { switch (delay_class) { case 1: - delay_data[pool].class1 = xmalloc(sizeof(class1DelayPool)); + delay_data[pool].class1 = (class1DelayPool *)xmalloc(sizeof(class1DelayPool)); delay_data[pool].class1->delay_class = 1; memory_used += sizeof(class1DelayPool); break; case 2: - delay_data[pool].class2 = xmalloc(sizeof(class2DelayPool)); + delay_data[pool].class2 = (class2DelayPool *)xmalloc(sizeof(class2DelayPool)); delay_data[pool].class1->delay_class = 2; memory_used += sizeof(class2DelayPool); break; case 3: - delay_data[pool].class3 = xmalloc(sizeof(class3DelayPool)); + delay_data[pool].class3 = (class3DelayPool *)xmalloc(sizeof(class3DelayPool)); delay_data[pool].class1->delay_class = 3; memory_used += sizeof(class3DelayPool); break; diff --git a/src/ftp.cc b/src/ftp.cc index 095e22e99b..7899865ed3 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.331 2002/10/14 08:16:58 robertc Exp $ + * $Id: ftp.cc,v 1.332 2002/10/14 08:43:46 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -920,7 +920,7 @@ ftpDataRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *da /* XXX what about Config.Timeout.read? */ read_sz = ftpState->data.size - ftpState->data.offset; #if DELAY_POOLS - read_sz = delayBytesWanted(delay_id, 1, read_sz); + read_sz = delayBytesWanted(delayId, 1, read_sz); #endif comm_read(fd, ftpState->data.buf + ftpState->data.offset, read_sz, ftpDataRead, data); } else { @@ -940,7 +940,7 @@ ftpDataRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *da /* XXX what about Config.Timeout.read? */ read_sz = ftpState->data.size - ftpState->data.offset; #if DELAY_POOLS - read_sz = delayBytesWanted(delay_id, 1, read_sz); + read_sz = delayBytesWanted(delayId, 1, read_sz); #endif comm_read(fd, ftpState->data.buf + ftpState->data.offset, read_sz, ftpDataRead, data);} } @@ -2139,7 +2139,7 @@ ftpReadRetr(FtpStateData * ftpState) /* XXX what about Config.Timeout.read? */ size_t read_sz = ftpState->data.size - ftpState->data.offset; #if DELAY_POOLS - read_sz = delayBytesWanted(delay_id, 1, read_sz); + read_sz = delayBytesWanted(delayId, 1, read_sz); #endif comm_read(ftpState->data.fd, ftpState->data.buf + ftpState->data.offset, read_sz, ftpDataRead, ftpState); -- 2.47.2