if (!CBIT_TEST(cd->mask, hashed_keys[0])) {
CBIT_SET(cd->mask, hashed_keys[0]);
- on_xition_cnt++;
+ ++on_xition_cnt;
}
if (!CBIT_TEST(cd->mask, hashed_keys[1])) {
CBIT_SET(cd->mask, hashed_keys[1]);
- on_xition_cnt++;
+ ++on_xition_cnt;
}
if (!CBIT_TEST(cd->mask, hashed_keys[2])) {
CBIT_SET(cd->mask, hashed_keys[2]);
- on_xition_cnt++;
+ ++on_xition_cnt;
}
if (!CBIT_TEST(cd->mask, hashed_keys[3])) {
CBIT_SET(cd->mask, hashed_keys[3]);
- on_xition_cnt++;
+ ++on_xition_cnt;
}
statCounter.cd.on_xition_count.count(on_xition_cnt);
}
#endif
- cd->count++;
+ ++ cd->count;
}
void
cacheDigestDel(CacheDigest * cd, const cache_key * key)
{
assert(cd && key);
- cd->del_count++;
+ ++ cd->del_count;
/* we do not support deletions from the digest */
}
const int is_on = 0 != CBIT_TEST(cd->mask, pos);
if (is_on)
- on_count++;
+ ++on_count;
if (is_on != cur_seq_type || !pos) {
seq_len_sum += cur_seq_len;
- seq_count++;
+ ++seq_count;
cur_seq_type = is_on;
cur_seq_len = 0;
}
- cur_seq_len++;
+ ++cur_seq_len;
}
stats->bit_count = cd->mask_size * 8;
int i;
int64_t ms = -1;
- for (i = 0; i < Config.cacheSwap.n_configured; i++) {
+ for (i = 0; i < Config.cacheSwap.n_configured; ++i) {
assert (Config.cacheSwap.swapDirs[i].getRaw());
if (dynamic_cast<SwapDir *>(Config.cacheSwap.swapDirs[i].getRaw())->
path, xstrerror());
}
}
- for (i = 0; i < (int)globbuf.gl_pathc; i++) {
+ for (i = 0; i < (int)globbuf.gl_pathc; ++i) {
error_count += parseOneConfigFile(globbuf.gl_pathv[i], depth);
}
globfree(&globbuf);
Vector<bool> if_states;
while (fgets(config_input_line, BUFSIZ, fp)) {
- config_lineno++;
+ ++config_lineno;
if ((token = strchr(config_input_line, '\n')))
*token = '\0';
continue; /* Not a valid #line directive, may be a comment */
while (*file && xisspace((unsigned char) *file))
- file++;
+ ++file;
if (*file) {
if (*file != '"')
err_count += parseManyConfigFiles(tmp_line + 8, depth + 1);
} else if (!parse_line(tmp_line)) {
debugs(3, 0, HERE << cfg_filename << ":" << config_lineno << " unrecognized: '" << tmp_line << "'");
- err_count++;
+ ++err_count;
}
}
char const * number_end = value;
while ((*number_end >= '0' && *number_end <= '9')) {
- number_end++;
+ ++number_end;
}
String number;
{
int i;
- for (i = 0; i < HDR_ENUM_END; i++) {
+ for (i = 0; i < HDR_ENUM_END; ++i) {
if (header[i].access_list != NULL) {
storeAppendPrintf(entry, "%s ", name);
dump_acl_access(entry, httpHeaderNameById(i),
*next_string = 'A';
*(next_string + 1) = ' ';
- for (i = 0; i < HDR_ENUM_END; i++) {
+ for (i = 0; i < HDR_ENUM_END; ++i) {
char *new_string = xstrdup(next_string);
strtok(new_string, w_space);
parse_acl_access(&header[i].access_list);
{
int i;
- for (i = 0; i < HDR_ENUM_END; i++) {
+ for (i = 0; i < HDR_ENUM_END; ++i) {
free_acl_access(&header[i].access_list);
}
}
{
int i;
- for (i = 0; i < HDR_ENUM_END; i++) {
+ for (i = 0; i < HDR_ENUM_END; ++i) {
if (NULL == header[i].replacement)
continue;
header[id].replacement = xstrdup(t + strlen(t) + 1);
} else {
- for (i = 0; i < HDR_ENUM_END; i++) {
+ for (i = 0; i < HDR_ENUM_END; ++i) {
if (header[i].replacement != NULL)
safe_free(header[i].replacement);
{
int i;
- for (i = 0; i < HDR_ENUM_END; i++) {
+ for (i = 0; i < HDR_ENUM_END; ++i) {
if (header[i].replacement != NULL)
safe_free(header[i].replacement);
}
int i;
assert (entry);
- for (i = 0; i < swap.n_configured; i++) {
+ for (i = 0; i < swap.n_configured; ++i) {
s = dynamic_cast<SwapDir *>(swap.swapDirs[i].getRaw());
if (!s) continue;
storeAppendPrintf(entry, "%s %s %s", name, s->type(), s->path);
/* reconfigure existing dir */
- for (i = 0; i < swap->n_configured; i++) {
+ for (i = 0; i < swap->n_configured; ++i) {
assert (swap->swapDirs[i].getRaw());
if ((strcasecmp(path_str, dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw())->path)) == 0) {
if (*domain == '!') { /* check for !.edu */
l->do_ping = 0;
- domain++;
+ ++domain;
}
l->domain = xstrdup(domain);
}
while (*token && xisspace(*token))
- token++;
+ ++token;
if (!*token) {
self_destruct();
s->tcp_keepalive.idle = atoi(t);
t = strchr(t, ',');
if (t) {
- t++;
+ ++t;
s->tcp_keepalive.interval = atoi(t);
t = strchr(t, ',');
}
if (t) {
- t++;
+ ++t;
s->tcp_keepalive.timeout = atoi(t);
t = strchr(t, ',');
}
fprintf(stderr, "%s scanning\n", fname);
while (fread(&s, sizeof(s), 1, file) == 1) {
- count++;
- idx->scanned_count++;
+ ++count;
+ ++ idx->scanned_count;
/* if (!s.sane())
* continue; */
CacheEntry *olde = (CacheEntry *) hash_lookup(idx->hash, s.key);
if (olde) {
- idx->bad_add_count++;
+ ++ idx->bad_add_count;
} else {
CacheEntry *e = cacheEntryCreate(&s);
hash_join(idx->hash, &e->hash);
- idx->count++;
+ ++ idx->count;
}
} else if (s.op == SWAP_LOG_DEL) {
CacheEntry *olde = (CacheEntry *) hash_lookup(idx->hash, s.key);
if (!olde)
- idx->bad_del_count++;
+ ++ idx->bad_del_count;
else {
assert(idx->count);
hash_remove_link(idx->hash, (hash_link *) olde);
hash_first(small_idx->hash);
for (hashr = hash_next(small_idx->hash)) {
- hashed_count++;
+ ++hashed_count;
if (hash_lookup(large_idx->hash, hashr->key))
- shared_count++;
+ ++shared_count;
}
assert(hashed_count == small_idx->count);
return usage(argv[0]);
if (argv[i][len - 1] == ':') {
- idxCount++;
+ ++idxCount;
if (len < 2 || idxCount > 2)
return usage(argv[0]);
char *t;
/* Clean up */
- for (k = 0; k < n_carp_peers; k++) {
+ for (k = 0; k < n_carp_peers; ++k) {
cbdataReferenceDone(carp_peers[k]);
}
if (p->weight == 0)
continue;
- n_carp_peers++;
+ ++n_carp_peers;
W += p->weight;
}
/* calculate this peers hash */
p->carp.hash = 0;
- for (t = p->name; *t != 0; t++)
+ for (t = p->name; *t != 0; ++t)
p->carp.hash += ROTATE_LEFT(p->carp.hash, 19) + (unsigned int) *t;
p->carp.hash += p->carp.hash * 0x62531965;
X_last = 0.0; /* Empty X_0, nullifies the first pow statement */
- for (k = 1; k <= K; k++) {
+ for (k = 1; k <= K; ++k) {
double Kk1 = (double) (K - k + 1);
p = carp_peers[k - 1];
p->carp.load_multiplier = (Kk1 * (p->carp.load_factor - P_last)) / Xn;
debugs(39, 2, "carpSelectParent: Calculating hash for " << urlCanonical(request));
/* select peer */
- for (k = 0; k < n_carp_peers; k++) {
+ for (k = 0; k < n_carp_peers; ++k) {
String key;
tp = carp_peers[k];
if (tp->options.carp_key.set) {
if (key.size()==0)
key=urlCanonical(request);
- for (const char *c = key.rawBuf(), *e=key.rawBuf()+key.size(); c < e; c++)
+ for (const char *c = key.rawBuf(), *e=key.rawBuf()+key.size(); c < e; ++c)
user_hash += ROTATE_LEFT(user_hash, 19) + *c;
combined_hash = (user_hash ^ tp->carp.hash);
combined_hash += combined_hash * 0x62531965;
c->valid = 1;
c->locks = 0;
c->cookie = (long) c ^ cbdata::Cookie;
- cbdataCount++;
+ ++cbdataCount;
#if USE_CBDATA_DEBUG
c->file = file;
assert(c->locks < INT_MAX);
- c->locks++;
+ ++ c->locks;
}
void
storeAppendPrintf(sentry, "\n");
storeAppendPrintf(sentry, "types\tsize\tallocated\ttotal\n");
- for (int i = 1; i < cbdata_types; i++) {
+ for (int i = 1; i < cbdata_types; ++i) {
MemAllocator *pool = cbdata_index[i].pool;
if (pool) {
shift = 12;
}
- for (; shift<sizeof(m_SocketAddr.sin6_addr) ; shift++) {
+ for (; shift<sizeof(m_SocketAddr.sin6_addr) ; ++shift) {
byte= *(ptr+shift);
if (byte == 0xFF) {
caught = ((byte & 0x80) == 0x00); /* Found a '0' at 'bit' ? */
if (!caught)
- len++;
+ ++len;
byte <<= 1;
}
unsigned int blen = sizeof(m_SocketAddr.sin6_addr)/sizeof(uint32_t);
unsigned int changes = 0;
- for (unsigned int i = 0; i < blen; i++) {
+ for (unsigned int i = 0; i < blen; ++i) {
if ((p1[i] & p2[i]) != p1[i])
- changes++;
+ ++changes;
p1[i] &= p2[i];
}
// loop a byte-wise compare
// NP: match MUST be R-to-L : L-to-R produces inconsistent gt/lt results at varying CIDR
// expected difference on CIDR is gt/eq or lt/eq ONLY.
- for (unsigned int i = 0 ; i < sizeof(m_SocketAddr.sin6_addr) ; i++) {
+ for (unsigned int i = 0 ; i < sizeof(m_SocketAddr.sin6_addr) ; ++i) {
if (l[i] < r[i])
return -1;
if (IsIPv6() && blen > 0) {
*p = '[';
- p++;
+ ++p;
}
/* 8 being space for [ ] : and port digits */
// find the end of the new string
while (*p != '\0' && p < buf+blen)
- p++;
+ ++p;
if (IsIPv6() && p < (buf+blen-1) ) {
*p = ']';
- p++;
+ ++p;
}
/* terminate just in case. */
time_t stop_time;
time(&stop_time);
if ((stop_time - startTime) < fastFailureTimeLimit)
- badFailures++;
+ ++badFailures;
else
badFailures = 0; // the failures are not "frequent" [any more]
logfileLineEnd(Logfile * lf)
{
lf->f_lineend(lf);
- lf->sequence_number++;
+ ++ lf->sequence_number;
}
void
b->written_len = 0;
b->len = 0;
dlinkAddTail(b, &b->node, &ll->bufs);
- ll->nbufs++;
+ ++ ll->nbufs;
}
static void
hash_join(hash, &fv->hash);
}
- fv->n++;
+ ++ fv->n;
}
void
if (entry->locked()) {
/* Shit, it is locked. we can't return this one */
- walker->locked++;
+ ++ walker->locked;
dlinkAddTail(entry, &lru_node->node, &lru->list);
goto try_again;
}
Snmp::Pdu::aggregate(const Pdu& pdu)
{
Must(varCount() == pdu.varCount());
- aggrCount++;
+ ++aggrCount;
for (variable_list* p_aggr = variables, *p_var = pdu.variables; p_var != NULL;
p_aggr = p_aggr->next_variable, p_var = p_var->next_variable) {
Must(p_aggr != NULL);
Ssl::ssl_error_t Ssl::GetErrorCode(const char *name)
{
- for (int i = 0; TheSslErrorArray[i].name != NULL; i++) {
+ //TODO: use a std::map?
+ for (int i = 0; TheSslErrorArray[i].name != NULL; ++i) {
if (strcmp(name, TheSslErrorArray[i].name) == 0)
return TheSslErrorArray[i].value;
}
int Ssl::ErrorDetail::convert(const char *code, const char **value) const
{
*value = "-";
- for (int i=0; ErrorFormatingCodes[i].code!=NULL; i++) {
+ for (int i=0; ErrorFormatingCodes[i].code!=NULL; ++i) {
const int len = strlen(ErrorFormatingCodes[i].code);
if (strncmp(code,ErrorFormatingCodes[i].code, len)==0) {
ErrorDetail::fmt_action_t action = ErrorFormatingCodes[i].fmt_action;
//ignore spaces, new lines and comment lines (starting with #) at the beggining
const char *s;
- for (s = buf.content(); (*s == '\n' || *s == ' ' || *s == '\t' || *s == '#') && s < e; s++) {
+ for (s = buf.content(); (*s == '\n' || *s == ' ' || *s == '\t' || *s == '#') && s < e; ++s) {
if (*s == '#')
- while (s<e && *s != '\n') s++; // skip untill the end of line
+ while (s<e && *s != '\n')
+ ++s; // skip untill the end of line
}
if ( s != e) {
: width(cnlNumber)
{
row = new char *[width + 1];
- for (size_t i = 0; i < width + 1; i++)
+ for (size_t i = 0; i < width + 1; ++i)
row[i] = NULL;
}
Ssl::CertificateDb::Row::~Row()
{
if (row) {
- for (size_t i = 0; i < width + 1; i++) {
+ for (size_t i = 0; i < width + 1; ++i) {
delete[](row[i]);
}
delete[](row);
unsigned long Ssl::CertificateDb::index_serial_hash(const char **a)
{
const char *n = a[Ssl::CertificateDb::cnlSerial];
- while (*n == '0') n++;
+ while (*n == '0')
+ ++n;
return lh_strhash(n);
}
int Ssl::CertificateDb::index_serial_cmp(const char **a, const char **b)
{
const char *aa, *bb;
- for (aa = a[Ssl::CertificateDb::cnlSerial]; *aa == '0'; aa++);
- for (bb = b[Ssl::CertificateDb::cnlSerial]; *bb == '0'; bb++);
+ for (aa = a[Ssl::CertificateDb::cnlSerial]; *aa == '0'; ++aa);
+ for (bb = b[Ssl::CertificateDb::cnlSerial]; *bb == '0'; ++bb);
return strcmp(aa, bb);
}
#endif
const Columns db_indexes[]={cnlSerial, cnlName};
- for (unsigned int i = 0; i < countof(db_indexes); i++) {
+ for (unsigned int i = 0; i < countof(db_indexes); ++i) {
#if OPENSSL_VERSION_NUMBER >= 0x1000004fL
if (LHASH_OF(OPENSSL_STRING) *fieldIndex = db.get()->index[db_indexes[i]])
lh_OPENSSL_STRING_delete(fieldIndex, (char **)row);
bool removed_one = false;
#if OPENSSL_VERSION_NUMBER >= 0x1000004fL
- for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); i++) {
+ for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); ++i) {
const char ** current_row = ((const char **)sk_OPENSSL_PSTRING_value(db.get()->data, i));
#else
- for (int i = 0; i < sk_num(db.get()->data); i++) {
+ for (int i = 0; i < sk_num(db.get()->data); ++i) {
const char ** current_row = ((const char **)sk_value(db.get()->data, i));
#endif
return false;
#if OPENSSL_VERSION_NUMBER >= 0x1000004fL
- for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); i++) {
+ for (int i = 0; i < sk_OPENSSL_PSTRING_num(db.get()->data); ++i) {
const char ** current_row = ((const char **)sk_OPENSSL_PSTRING_value(db.get()->data, i));
#else
- for (int i = 0; i < sk_num(db.get()->data); i++) {
+ for (int i = 0; i < sk_num(db.get()->data); ++i) {
const char ** current_row = ((const char **)sk_value(db.get()->data, i));
#endif
if (host == current_row[cnlName]) {
stream << "Port" << delimiter << "Max mem(KB)" << delimiter << "Cert number" << delimiter << "KB/cert" << delimiter << "Mem used(KB)" << delimiter << "Mem free(KB)" << endString;
// Add info for each port.
- for (std::map<Ip::Address, LocalContextStorage *>::iterator i = TheGlobalContextStorage.storage.begin(); i != TheGlobalContextStorage.storage.end(); i++) {
+ for (std::map<Ip::Address, LocalContextStorage *>::iterator i = TheGlobalContextStorage.storage.begin(); i != TheGlobalContextStorage.storage.end(); ++i) {
stream << i->first << delimiter;
LocalContextStorage & ssl_store_policy(*(i->second));
stream << ssl_store_policy.max_memory / 1024 << delimiter;
Ssl::LocalContextStorage::~LocalContextStorage()
{
- for (QueueIterator i = lru_queue.begin(); i != lru_queue.end(); i++) {
+ for (QueueIterator i = lru_queue.begin(); i != lru_queue.end(); ++i) {
delete *i;
}
}
Ssl::GlobalContextStorage::~GlobalContextStorage()
{
- for (std::map<Ip::Address, LocalContextStorage *>::iterator i = storage.begin(); i != storage.end(); i++) {
+ for (std::map<Ip::Address, LocalContextStorage *>::iterator i = storage.begin(); i != storage.end(); ++i) {
delete i->second;
}
}
reconfiguring = false;
// remove or change old local storages.
- for (std::map<Ip::Address, LocalContextStorage *>::iterator i = storage.begin(); i != storage.end(); i++) {
+ for (std::map<Ip::Address, LocalContextStorage *>::iterator i = storage.begin(); i != storage.end(); ++i) {
std::map<Ip::Address, size_t>::iterator conf_i = configureStorage.find(i->first);
if (conf_i == configureStorage.end()) {
storage.erase(i);
switch (state) {
case BEFORE_CODE: {
if (xisspace(*current_pos)) {
- current_pos++;
+ ++current_pos;
break;
}
if (xisalpha(*current_pos)) {
case CODE: {
if (xisalnum(*current_pos) || *current_pos == '_') {
current_block += *current_pos;
- current_pos++;
+ ++current_pos;
break;
}
if (xisspace(*current_pos)) {
}
case BEFORE_LENGTH: {
if (xisspace(*current_pos)) {
- current_pos++;
+ ++current_pos;
break;
}
if (xisdigit(*current_pos)) {
case LENGTH: {
if (xisdigit(*current_pos)) {
current_block += *current_pos;
- current_pos++;
+ ++current_pos;
break;
}
if (xisspace(*current_pos)) {
break;
}
if (xisspace(*current_pos)) {
- current_pos++;
+ ++current_pos;
break;
} else {
state = BODY;
void Ssl::CrtdMessage::composeBody(CrtdMessage::BodyParams const & map, std::string const & other_part)
{
body.clear();
- for (BodyParams::const_iterator i = map.begin(); i != map.end(); i++) {
+ for (BodyParams::const_iterator i = map.begin(); i != map.end(); ++i) {
if (i != map.begin())
body += "\n";
body += i->first + "=" + i->second;
char const * number_end = value;
while ((*number_end >= '0' && *number_end <= '9')) {
- number_end++;
+ ++number_end;
}
std::string number(number_begin, number_end - number_begin);
if (altnames) {
int numalts = sk_GENERAL_NAME_num(altnames);
- for (int i = 0; i < numalts; i++) {
+ for (int i = 0; i < numalts; ++i) {
const GENERAL_NAME *check = sk_GENERAL_NAME_value(altnames, i);
if (check->type != GEN_DNS) {
continue;
case '-':
mode = MODE_REMOVE;
- option++;
+ ++option;
break;
case '+':
mode = MODE_ADD;
- option++;
+ ++option;
break;
default:
break;
}
- for (opttmp = ssl_options; opttmp->name; opttmp++) {
+ for (opttmp = ssl_options; opttmp->name; ++opttmp) {
if (strcmp(opttmp->name, option) == 0) {
opt = opttmp;
break;
if (!X509_STORE_add_crl(st, crl))
debugs(83, 2, "WARNING: Failed to add CRL from file '" << CRLfile << "'");
else
- count++;
+ ++count;
X509_CRL_free(crl);
}
mem = BIO_new(BIO_s_mem());
- for (i = 0; i < sk_X509_num(chain); i++) {
+ for (i = 0; i < sk_X509_num(chain); ++i) {
X509 *cert = sk_X509_value(chain, i);
PEM_write_bio_X509(mem, cert);
}
if (!chain)
return;
- for (int i = 0; i < sk_X509_num(chain); i++) {
+ for (int i = 0; i < sk_X509_num(chain); ++i) {
X509 *cert = sk_X509_value(chain, i);
if (SSL_CTX_add_extra_chain_cert(sslContext, cert)) {
// increase the certificate lock
self_destruct();
while (*token && xisspace(*token))
- token++;
+ ++token;
if (!*token)
self_destruct();
{"negotiate", "Negotiate "}
};
- for (unsigned count = 0; count < 4 ; count++) {
+ for (unsigned count = 0; count < 4 ; ++count) {
if (strcasecmp(type, proxy_auths[count][0]) == 0)
return proxy_auths[count][1];
}
{
Auth::ConfigVector &config = Auth::TheConfig;
- for (unsigned position=0; position < param_count; position++) {
+ for (unsigned position=0; position < param_count; ++position) {
char *param_str=xstrdup(params[position]);
strtok(param_str, w_space);
scheme->parse(scheme, config.size(), param_str);
{"negotiate", negotiate_parms, 1}
};
- for (unsigned scheme=0; scheme < 4; scheme++) {
+ for (unsigned scheme=0; scheme < 4; ++scheme) {
Auth::Config *schemeConfig;
schemeConfig = getConfig(params[scheme].name);
if (schemeConfig != NULL)
/* loop over the strings, showing exactly where they differ (if at all) */
printf("Actual Text:\n");
/* TODO: these should really be just [] lookups, but String doesn't have those here yet. */
- for ( unsigned int i = 0; i < anEntry->_appended_text.size(); i++) {
+ for ( unsigned int i = 0; i < anEntry->_appended_text.size(); ++i) {
CPPUNIT_ASSERT( expect[i] );
CPPUNIT_ASSERT( anEntry->_appended_text[i] );
e->swap_filen = 0; /* garh - lower level*/
e->swap_dirn = -1;
- for (int i=0; i < Config.cacheSwap.n_configured; i++) {
+ for (int i=0; i < Config.cacheSwap.n_configured; ++i) {
if (INDEXSD (i) == aStore.getRaw())
e->swap_dirn = i;
}
e->swap_filen = 0; /* garh - lower level*/
e->swap_dirn = -1;
- for (int i=0; i < Config.cacheSwap.n_configured; i++) {
+ for (int i=0; i < Config.cacheSwap.n_configured; ++i) {
if (INDEXSD (i) == aStore.getRaw())
e->swap_dirn = i;
}