x->net_db_entry = n;
assert(hash_lookup(host_table, hostname) == NULL);
hash_join(host_table, &x->hash);
- n->link_count++;
+ ++ n->link_count;
}
static void
assert(x != NULL);
assert(x->net_db_entry != NULL);
n = x->net_db_entry;
- n->link_count--;
+ -- n->link_count;
for (X = &n->hosts; *X; X = &(*X)->next) {
if (*X == x) {
while ((n = (netdbEntry *) hash_next(addr_table))) {
assert(list_count < memInUse(MEM_NETDBENTRY));
*(list + list_count) = n;
- list_count++;
+ ++list_count;
}
qsort((char *) list,
sizeof(netdbEntry *),
netdbLRU);
- for (k = 0; k < list_count; k++) {
+ for (k = 0; k < list_count; ++k) {
if (memInUse(MEM_NETDBENTRY) < Config.Netdb.low)
break;
netdbRelease(*(list + k));
- removed++;
+ ++removed;
}
xfree(list);
}
}
- n->link_count--;
+ -- n->link_count;
/* point to 'network na' from host entry */
x->net_db_entry = na;
/* link net_db_name to 'network na' */
x->next = na->hosts;
na->hosts = x;
- na->link_count++;
+ ++ na->link_count;
n = na;
}
if (n->next_ping_time <= squid_curtime) {
debugs(38, 3, "netdbSendPing: pinging " << hostname);
icmpEngine.DomainPing(addr, hostname);
- n->pings_sent++;
+ ++ n->pings_sent;
n->next_ping_time = squid_curtime + Config.Netdb.period;
n->last_use_time = squid_curtime;
}
int i;
net_db_peer *p = n->peers;
- for (i = 0; i < n->n_peers; i++, p++) {
+ for (i = 0; i < n->n_peers; ++i, ++p) {
if (!strcmp(p->peername, peername))
return p;
}
n->peers = (net_db_peer *)xcalloc(n->n_peers_alloc, sizeof(net_db_peer));
- for (i = 0; i < osize; i++)
+ for (i = 0; i < osize; ++i)
*(n->peers + i) = *(o + i);
if (osize) {
p = n->peers + n->n_peers;
p->peername = netdbPeerName(e->host);
- n->n_peers++;
+ ++ n->n_peers;
return p;
}
logfilePrintf(lf, "\n");
- count++;
+ ++count;
#undef RBUF_SZ
netdbHostInsert(n, q);
}
- count++;
+ ++count;
}
xfree(buf);
switch ((int) *(p + o)) {
case NETDB_EX_NETWORK:
- o++;
+ ++o;
/* FIXME INET6 : NetDB can still ony send IPv4 */
memcpy(&line_addr, p + o, sizeof(struct in_addr));
addr = line_addr;
break;
case NETDB_EX_RTT:
- o++;
+ ++o;
memcpy(&j, p + o, sizeof(int));
o += sizeof(int);
rtt = (double) ntohl(j) / 1000.0;
break;
case NETDB_EX_HOPS:
- o++;
+ ++o;
memcpy(&j, p + o, sizeof(int));
o += sizeof(int);
hops = (double) ntohl(j) / 1000.0;
p += rec_sz;
- nused++;
+ ++nused;
}
/*
sizeof(netdbEntry *),
sortByRtt);
- for (k = 0; k < i; k++) {
+ for (k = 0; k < i; ++k) {
n = *(list + k);
storeAppendPrintf(sentry, "%-46.46s %4d/%4d %7.1f %5.1f", /* Max between 16 (IPv4) or 46 (IPv6) */
n->network,
p = n->peers;
- for (j = 0; j < n->n_peers; j++, p++) {
+ for (j = 0; j < n->n_peers; ++j, ++p) {
storeAppendPrintf(sentry, " %-22.22s %7.1f %5.1f\n",
p->peername,
p->rtt,
* Make sure we don't return a parent who is farther away than
* we are. Note, the n->peers list is pre-sorted by RTT.
*/
- for (i = 0; i < n->n_peers; i++) {
+ for (i = 0; i < n->n_peers; ++i) {
h = &n->peers[i];
if (n->rtt > 0)