Skip to content

Commit

Permalink
slirp: remove remaining DEBUG blocks
Browse files Browse the repository at this point in the history
Instead, rely on slirp_debug flags, or compile unconditionally (the
substraction in cksum is unlikely to affect any benchmark result).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
  • Loading branch information
elmarco authored and sthibaul committed Jan 13, 2019
1 parent 3402618 commit eb0b159
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
4 changes: 0 additions & 4 deletions slirp/cksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ int cksum(struct mbuf *m, int len)

if (len < mlen)
mlen = len;
#ifdef DEBUG
len -= mlen;
#endif
/*
* Force to even boundary.
*/
Expand Down Expand Up @@ -122,12 +120,10 @@ int cksum(struct mbuf *m, int len)
s_util.c[0] = *(uint8_t *)w;

cont:
#ifdef DEBUG
if (len) {
DEBUG_ERROR("cksum: out of data\n");
DEBUG_ERROR(" len = %d\n", len);
}
#endif
if (mlen == -1) {
/* The last mbuf has odd # of bytes. Follow the
standard (the odd byte may be shifted left by 8 bits
Expand Down
5 changes: 2 additions & 3 deletions slirp/ip_icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,12 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
/* check msrc */
if(!msrc) goto end_error;
ip = mtod(msrc, struct ip *);
#ifdef DEBUG
{ char bufa[20], bufb[20];
if (slirp_debug & DBG_MISC) {
char bufa[20], bufb[20];
strcpy(bufa, inet_ntoa(ip->ip_src));
strcpy(bufb, inet_ntoa(ip->ip_dst));
DEBUG_MISC(" %.16s to %.16s\n", bufa, bufb);
}
#endif
if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */

/* Do not reply to source-only IPs */
Expand Down
5 changes: 1 addition & 4 deletions slirp/slirp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,14 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
if (++found > 3) {
DEBUG_MISC("(more)");
break;
}
#ifdef DEBUG
else {
} else if (slirp_debug & DBG_MISC) {
char s[INET6_ADDRSTRLEN];
const char *res = inet_ntop(af, tmp_addr, s, sizeof(s));
if (!res) {
res = "(string conversion error)";
}
DEBUG_MISC("%s", res);
}
#endif
}
}
fclose(f);
Expand Down

0 comments on commit eb0b159

Please sign in to comment.