iter = memPoolIterate();
while ((pool = memPoolIterateNext(iter))) {
if (pool->getStats(&pp_stats, 1) > 0)
- pools_inuse++;
+ ++pools_inuse;
}
memPoolIterateDone(&iter);
freeList = objCache;
void **Free = (void **)freeList;
- for (int i = 1; i < pool->chunk_capacity; i++) {
+ for (int i = 1; i < pool->chunk_capacity; ++i) {
*Free = (void *) ((char *) Free + pool->obj_size);
void **nextFree = (void **)*Free;
(void) VALGRIND_MAKE_MEM_NOACCESS(Free, pool->obj_size);
memMeterAdd(pool->getMeter().alloc, pool->chunk_capacity);
memMeterAdd(pool->getMeter().idle, pool->chunk_capacity);
- pool->chunkCount++;
+ ++pool->chunkCount;
lastref = squid_curtime;
pool->allChunks.insert(this, memCompChunks);
}
{
void **Free;
- saved_calls++;
+ ++saved_calls;
/* first, try cache */
if (freeCache) {
Free = (void **)chunk->freeList;
chunk->freeList = *Free;
*Free = NULL;
- chunk->inuse_count++;
+ ++chunk->inuse_count;
chunk->lastref = squid_curtime;
if (chunk->freeList == NULL) {
chunk = Chunks;
while (chunk) {
if (chunk->inuse_count == 0)
- chunks_free++;
+ ++chunks_free;
else if (chunk->inuse_count < chunk_capacity)
- chunks_partial++;
+ ++chunks_partial;
chunk = chunk->next;
}
void *obj = freelist.pop();
if (obj) {
memMeterDec(meter.idle);
- saved_calls++;
+ ++saved_calls;
} else {
obj = xcalloc(1, obj_size);
memMeterInc(meter.alloc);
unsigned int j = 0;
unsigned int i = 0;
while (*s) {
- j++;
+ ++j;
n ^= 271 * (*s++);
}
i = n ^ (j * 271);
i = hid->hash(lnk->key, hid->size);
lnk->next = hid->buckets[i];
hid->buckets[i] = lnk;
- hid->count++;
+ ++hid->count;
}
/**
if (NULL == hid->next)
hash_next_bucket(hid);
}
- hid->count--;
+ --hid->count;
return;
}
assert(0);
hash_first(hid);
while ((l = hash_next(hid)) && i < hid->count) {
*(list + i) = l;
- i++;
+ ++i;
}
- for (int j = 0; j < i; j++)
+ for (int j = 0; j < i; ++j)
free_func(*(list + j));
xfree(list);
}
int best_prime = hash_primes[0];
double min = fabs(log((double) n) - log((double) hash_primes[0]));
double d;
- for (int i = 0; i < I; i++) {
+ for (int i = 0; i < I; ++i) {
d = fabs(log((double) n) - log((double) hash_primes[i]));
if (d > min)
continue;
/* calloc the ptrs so that we don't see them when hunting lost memory */
malloc_ptrs = calloc(DBG_ARRY_BKTS, sizeof(*malloc_ptrs));
- for (B = 0; B < DBG_ARRY_BKTS; B++) {
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (B = 0; B < DBG_ARRY_BKTS; ++B) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
malloc_ptrs[B][I] = NULL;
malloc_size[B][I] = 0;
#if XMALLOC_TRACE
int B, I;
B = DBG_HASH_BUCKET(s);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] != s)
continue;
B = DBG_HASH_BUCKET(p);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (!(P = malloc_ptrs[B][I]))
continue;
}
}
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I])
continue;
int B, I;
B = DBG_HASH_BUCKET(p);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] == p)
return malloc_size[B][I];
}
int B, I;
B = DBG_HASH_BUCKET(p);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] == p)
return malloc_file[B][I];
}
int B, I;
B = DBG_HASH_BUCKET(p);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] == p)
return malloc_line[B][I];
}
int B, I;
B = DBG_HASH_BUCKET(p);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] == p)
return malloc_count[B][I];
}
if (p && p != start) {
B = DBG_HASH_BUCKET(p);
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] == p) {
if (!malloc_refs[B][I]++) {
/* A new reference */
fprintf(stderr, "----- Memory map ----\n");
xmalloc_scan_region(&_etext, (void *) sbrk(0) - (void *) &_etext, 0);
- for (B = 0; B < DBG_ARRY_BKTS; B++) {
- for (I = 0; I < DBG_ARRY_SZ; I++) {
+ for (B = 0; B < DBG_ARRY_BKTS; ++B) {
+ for (I = 0; I < DBG_ARRY_SZ; ++I) {
if (malloc_ptrs[B][I] && malloc_refs[B][I] == 0) {
/* Found a leak... */
fprintf(stderr, "Leak found: %p", malloc_ptrs[B][I]);
unsigned short *s = (unsigned short *)rv.str;
rv.str = d = buf;
- for (l >>= 1; l; s++, l--) {
+ for (l >>= 1; l; ++s, --l) {
unsigned short c = le16toh(*s);
if (c > 254 || c == '\0') {
fprintf(stderr, "ntlmssp: bad unicode: %04x\n", c);
return rv;
}
*d++ = c;
- rv.l++;
+ ++rv.l;
}
} else {
/* ASCII/OEM string */
char *sc = rv.str;
- for (; l>=0; sc++, l--) {
+ for (; l>=0; ++sc, --l) {
if (*sc == '\0' || !xisprint(*sc)) {
fprintf(stderr, "ntlmssp: bad ascii: %04x\n", *sc);
return rv;
}
- rv.l++;
+ ++rv.l;
}
}
int r = (int) rand();
r = (hash ^ r) + r;
- for (i = 0; i < NTLM_NONCE_LEN; i++) {
+ for (i = 0; i < NTLM_NONCE_LEN; ++i) {
nonce[i] = r;
r = (r >> 2) ^ r;
}
if (head->worst < head->delta)
head->worst = head->delta;
head->summ += head->delta;
- head->count++;
+ ++head->count;
}
static xprof_stats_data *xp_UNACCOUNTED;
cstack[cstack_head].accum = 0;
cstack[cstack_head].timer = type;
cstack[cstack_head].name = timer;
- cstack_head++;
+ ++cstack_head;
assert(cstack_head < MAXSTACKDEPTH);
}
{
hrtime_t tt = get_tick();
assert(cstack_head > 0);
- cstack_head--;
+ --cstack_head;
assert(cstack[cstack_head].timer == type);
/* Record timer details */
void
asnInit(void)
{
- static int inited = 0;
+ static bool inited = false;
squid_max_keylen = 40;
CBDATA_INIT_TYPE(ASState);
- if (0 == inited++)
+ if (!inited) {
+ inited = true;
squid_rn_init();
+ }
squid_rn_inithead(&AS_tree_head, 8);
while ((size_t)(s - buf) < result.length + asState->reqofs && *s != '\0') {
while (*s && xisspace(*s))
- s++;
+ ++s;
- for (t = s; *t; t++) {
+ for (t = s; *t; ++t) {
if (xisspace(*t))
break;
}
const ipcache_addrs *ia = ipcache_gethostbyname(checklist->request->GetHost(), IP_LOOKUP_IF_MISS);
if (ia) {
- for (int k = 0; k < (int) ia->count; k++) {
+ for (int k = 0; k < (int) ia->count; ++k) {
if (data->match(ia->in_addrs[k]))
return 1;
}
if (ia) {
/* Entry in cache found */
- for (int k = 0; k < (int) ia->count; k++) {
+ for (int k = 0; k < (int) ia->count; ++k) {
if (ACLIP::match(ia->in_addrs[k]))
return 1;
}
if (*t == '!') {
L->negated (true);
- t++;
+ ++t;
}
debugs(28, 3, "aclParseAclList: looking for ACL name '" << t << "'");
if (!addr2.IsAnyAddr()) {
b2[0] = '-';
- rlen++;
+ ++rlen;
addr2.NtoA(&(b2[1]), len - rlen );
rlen = strlen(buf);
} else
if (!mask.IsNoAddr()) {
b3[0] = '/';
- rlen++;
+ ++rlen;
int cidr = mask.GetCIDR() - (addr1.IsIPv4()?96:0);
snprintf(&(b3[1]), (len-rlen), "%u", (unsigned int)(cidr<0?0:cidr) );
} else
if (largeREindex > 0)
largeRE[largeREindex++] = '|';
largeRE[largeREindex++] = '(';
- for (char * t = wl->key; *t != '\0'; t++)
+ for (char * t = wl->key; *t != '\0'; ++t)
largeRE[largeREindex++] = *t;
largeRE[largeREindex++] = ')';
largeRE[largeREindex] = '\0';
- numREs++;
+ ++numREs;
} else {
debugs(28, 2, "compileOptimisedREs: buffer full, generating new optimised RE..." );
newlistp = compileRE( newlistp, largeRE, flags );
ServicePointer s = createService(cfg);
if (s != NULL) {
AllServices().push_back(s);
- created++;
+ ++created;
}
}
ConfigParser::ParseQuotedString(&value);
// TODO: Find a way to move this check to ICAP
- for (int i = 0; warnFor[i] != NULL; i++) {
+ for (int i = 0; warnFor[i] != NULL; ++i) {
if (name.caseCmp(warnFor[i]) == 0) {
fatalf("%s:%d: meta name \"%s\" is a reserved ICAP header name",
cfg_filename, config_lineno, name.termedBuf());
if ((t = strchr(s, ']')) == NULL)
return false;
- s++;
+ ++s;
len = t - s;
if ((e = strchr(t, ':')) != NULL) {
have_port = true;
port = -1;
if (have_port) {
- s++;
+ ++s;
if ((e = strchr(s, '/')) != NULL) {
char *t;
// if no port, the caller may use service_configConfigs or supply the default if neeeded
- s++;
+ ++s;
e = strchr(s, '\0');
len = e - s;
method_list.append(ICAP::methodStr(*iter));
method_list.append(" ", 1);
- iter++;
+ ++iter;
}
if (!method_found) {
if (!found) {
/* This ip is not in the seen list. Add it. */
dlinkAddTail(&new_ipdata->node, &ipdata->node, &ip_list);
- ipcount++;
+ ++ipcount;
/* remove from the source list */
dlinkDelete(&new_ipdata->node, &(from->ip_list));
- from->ipcount--;
+ ++from->ipcount;
}
}
}
dlinkAddTail(ipdata, &ipdata->node, &ip_list);
- ipcount++;
+ ++ipcount;
debugs(29, 2, HERE << "user '" << username() << "' has been seen at a new IP address (" << ipaddr << ")");
}
/* trim BASIC from string */
while (xisgraph(*proxy_auth))
- proxy_auth++;
+ ++proxy_auth;
/* Trim leading whitespace before decoding */
while (xisspace(*proxy_auth))
- proxy_auth++;
+ ++proxy_auth;
/* Trim trailing \n before decoding */
// XXX: really? is the \n actually still there? does the header parse not drop it?
/* create a new nonce */
newnonce->noncedata.randomdata = squid_random();
/* Bug 3526 high performance fix: add 1 second to creationtime to avoid duplication */
- newnonce->noncedata.creationtime++;
+ ++newnonce->noncedata.creationtime;
authDigestNonceEncode(newnonce);
}
authDigestNonceLink(digest_nonce_h * nonce)
{
assert(nonce != NULL);
- nonce->references++;
+ ++nonce->references;
debugs(29, 9, "authDigestNonceLink: nonce '" << nonce << "' now at '" << nonce->references << "'.");
}
/* is the nonce-count ok ? */
if (!static_cast<Auth::Digest::Config*>(Auth::Config::Find("digest"))->CheckNonceCount) {
- nonce->nc++;
+ ++nonce->nc;
return -1; /* forced OK by configuration */
}
/* trim DIGEST from string */
while (xisgraph(*proxy_auth))
- proxy_auth++;
+ ++proxy_auth;
/* Trim leading whitespace before decoding */
while (xisspace(*proxy_auth))
- proxy_auth++;
+ ++proxy_auth;
String temp(proxy_auth);
if (blob) {
while (xisspace(*blob) && *blob)
- blob++;
+ ++blob;
while (!xisspace(*blob) && *blob)
- blob++;
+ ++blob;
while (xisspace(*blob) && *blob)
- blob++;
+ ++blob;
}
switch (user()->credentials()) {
/* if proxy_auth is actually NULL, we'd better not manipulate it. */
if (blob) {
while (xisspace(*blob) && *blob)
- blob++;
+ ++blob;
while (!xisspace(*blob) && *blob)
- blob++;
+ ++blob;
while (xisspace(*blob) && *blob)
- blob++;
+ ++blob;
}
switch (user()->credentials()) {
/* seperate out the useful data */
blob = strchr(reply, ' ');
if (blob)
- blob++;
+ ++blob;
if (strncasecmp(reply, "TT ", 3) == 0) {
/* we have been given a blob to send to the client */
s = strrchr(fname, '/');
if (s)
- s++;
+ ++s;
else
s = fname;
while (*s) {
- j++;
+ ++j;
n ^= 271 * (unsigned) *s++;
}
i = n ^ (j * 271);
int no = name[current->len] ;
int i;
// Note: This works because the Config.peers keeps its index according to its position.
- for ( i=0 ; peers && (i < no) ; peers = peers->next , i++ ) ;
+ for ( i=0 ; peers && (i < no) ; peers = peers->next , ++i ) ;
if (peers) {
debugs(49, 6, "snmp peer_Inst: Encode peer #" << i);