Make libbind buildable in DEBUG mode, too:

* fix strange overloads of functions via macros that doesn't work
  (and I can't see how it ever would, but what the heck)
* don't force-define DEBUG in libbind/resolv, follow our build system's
  idea of DEBUG instead
* fix libbind/isc/tree.c expecting DEBUG to contain a string

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40528 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2011-02-16 15:24:22 +00:00
parent efccf04aaf
commit 51974c5df0
8 changed files with 43 additions and 33 deletions

View File

@ -38,7 +38,9 @@ static const char rcsid[] = "$Id: tree.c,v 1.4 2005/04/27 04:56:39 sra Exp $";
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*#define DEBUG "tree"*/
#ifdef DEBUG
# define DEBUG_DOMAIN "tree"
#endif
#include "port_before.h"
@ -56,21 +58,21 @@ static char *debugFuncs[256];
# define ENTER(proc) { \
debugFuncs[debugDepth] = proc; \
fprintf(stderr, "ENTER(%d:%s.%s)\n", \
debugDepth, DEBUG, \
debugDepth, DEBUG_DOMAIN, \
debugFuncs[debugDepth]); \
debugDepth++; \
}
# define RET(value) { \
debugDepth--; \
fprintf(stderr, "RET(%d:%s.%s)\n", \
debugDepth, DEBUG, \
debugDepth, DEBUG_DOMAIN, \
debugFuncs[debugDepth]); \
return (value); \
}
# define RETV { \
debugDepth--; \
fprintf(stderr, "RETV(%d:%s.%s)\n", \
debugDepth, DEBUG, \
debugDepth, DEBUG_DOMAIN, \
debugFuncs[debugDepth]); \
return; \
}
@ -99,7 +101,7 @@ tree_init(tree **ppr_tree) {
*ppr_tree = NULL;
RETV
}
tree_t
tree_srch(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t), tree_t p_user) {
ENTER("tree_srch")

View File

@ -21,7 +21,7 @@
#ifndef DEBUG
# define Dprint(cond, args) /*empty*/
# define DprintQ(cond, args, query, size) /*empty*/
# define Aerror(statp, file, string, error, address) /*empty*/
# define Aerror(statp, file, string, error, address, addrLen) /*empty*/
# define Perror(statp, file, string, error) /*empty*/
#else
# define Dprint(cond, args) if (cond) {fprintf args;} else {}
@ -31,5 +31,5 @@
} else {}
#endif
#endif /* _RES_DEBUG_H_ */
#endif /* _RES_DEBUG_H_ */
/*! \file */

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1985, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -17,7 +17,7 @@
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@ -33,14 +33,14 @@
/*
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
@ -108,7 +108,7 @@
/*% Options. Should all be left alone. */
#define RESOLVSORT
#define DEBUG
//#define DEBUG
#ifdef SOLARIS2
#include <sys/systeminfo.h>
@ -140,7 +140,7 @@ static u_int32_t net_mask __P((struct in_addr));
* since it was noted that INADDR_ANY actually meant ``the first interface
* you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface,
* it had to be "up" in order for you to reach your own name server. It
* was later decided that since the recommended practice is to always
* was later decided that since the recommended practice is to always
* install local static routes through 127.0.0.1 for all your network
* interfaces, that we could solve this problem without a code change.
*
@ -440,11 +440,11 @@ __res_vinit(res_state statp, int preinit) {
if (inet_aton(net, &a)) {
statp->sort_list[nsort].mask = a.s_addr;
} else {
statp->sort_list[nsort].mask =
statp->sort_list[nsort].mask =
net_mask(statp->sort_list[nsort].addr);
}
} else {
statp->sort_list[nsort].mask =
statp->sort_list[nsort].mask =
net_mask(statp->sort_list[nsort].addr);
}
nsort++;
@ -459,7 +459,7 @@ __res_vinit(res_state statp, int preinit) {
continue;
}
}
if (nserv > 0)
if (nserv > 0)
statp->nscount = nserv;
#ifdef RESOLVSORT
statp->nsort = nsort;
@ -711,7 +711,7 @@ void
res_nclose(res_state statp) {
int ns;
if (statp->_vcsock >= 0) {
if (statp->_vcsock >= 0) {
(void) close(statp->_vcsock);
statp->_vcsock = -1;
statp->_flags &= ~(RES_F_VC | RES_F_CONN);
@ -795,7 +795,7 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
set++;
}
statp->nscount = nserv;
}
int
@ -807,7 +807,7 @@ res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
for (i = 0; i < statp->nscount && i < cnt; i++) {
if (statp->_u._ext.ext)
family = statp->_u._ext.ext->nsaddrs[i].sin.sin_family;
else
else
family = statp->nsaddr_list[i].sin_family;
switch (family) {

View File

@ -85,7 +85,7 @@ static const char rcsid[] = "$Id: res_mkquery.c,v 1.10 2008/12/11 09:59:00 marka
#include "port_after.h"
/* Options. Leave them on. */
#define DEBUG
//#define DEBUG
extern const char *_res_opcodes[];

View File

@ -48,7 +48,7 @@ static const char rcsid[] = "$Id: res_mkupdate.c,v 1.10 2008/12/11 09:59:00 mark
#include "port_after.h"
/* Options. Leave them on. */
#define DEBUG
//#define DEBUG
#define MAXPORT 1024
static int getnum_str(u_char **, u_char *);
@ -68,7 +68,7 @@ int res_servicenumber(const char *);
* Returns the size of the resulting packet if no error
*
* On error,
* returns
* returns
*\li -1 if error in reading a word/number in rdata
* portion for update packets
*\li -2 if length of buffer passed is insufficient
@ -348,7 +348,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
return (-1);
ShrinkBuffer(1);
*cp++ = i & 0xff;
for (i = 0; i < MAXPORT/8 ; i++)
bm[i] = 0;
@ -704,7 +704,7 @@ res_nmkupdate(res_state statp, ns_updrec *rrecp_in, u_char *buf, int buflen) {
n = (u_int16_t)((cp - sp2) - INT16SZ);
PUTSHORT(n, sp2);
} /*for*/
hp->qdcount = htons(counts[0]);
hp->ancount = htons(counts[1]);
hp->nscount = htons(counts[2]);
@ -721,7 +721,7 @@ static int
getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
char *cp;
int c;
for (cp = buf; *startpp <= endp; ) {
c = **startpp;
if (isspace(c) || c == '\0') {
@ -755,7 +755,7 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
int seen_quote = 0;
int escape = 0;
int dig = 0;
for (cp = buf; *startpp <= endp; ) {
if ((c = **startpp) == '\0')
break;
@ -773,7 +773,7 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
c1 = 0;
(*startpp)++;
continue;
}
}
goto do_escape;
case '"':
if (!escape) {
@ -797,7 +797,7 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
case '7':
case '8':
case '9':
c1 = c1 * 10 +
c1 = c1 * 10 +
(strchr(digits, c) - digits);
if (++dig == 3) {
@ -858,7 +858,7 @@ gethexnum_str(u_char **startpp, u_char *endp) {
break;
}
return (-1);
}
}
(*startpp)++;
if (isdigit(c))
n = n * 16 + (c - '0');
@ -903,7 +903,7 @@ getnum_str(u_char **startpp, u_char *endp) {
break;
}
return (-1);
}
}
(*startpp)++;
n = n * 10 + (c - '0');
seendigit = 1;

View File

@ -89,7 +89,7 @@ static const char rcsid[] = "$Id: res_query.c,v 1.11 2008/11/14 02:36:51 marka E
#include "port_after.h"
/* Options. Leave them on. */
#define DEBUG
//#define DEBUG
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ

View File

@ -112,7 +112,7 @@ static const char rcsid[] = "$Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp
#endif /* USE_POLL */
/* Options. Leave them on. */
#define DEBUG
//#define DEBUG
#include "res_debug.h"
#include "res_private.h"
@ -133,9 +133,11 @@ static int send_vc(res_state, const u_char *, int,
static int send_dg(res_state, const u_char *, int,
u_char *, int, int *, int, int,
int *, int *);
#ifdef DEBUG
static void Aerror(const res_state, FILE *, const char *, int,
const struct sockaddr *, int);
static void Perror(const res_state, FILE *, const char *, int);
#endif // DEBUG
static int sock_eq(struct sockaddr *, struct sockaddr *);
#if defined(NEED_PSELECT) && !defined(USE_POLL)
static int pselect(int, void *, void *, void *,
@ -294,7 +296,9 @@ res_nsend(res_state statp,
const u_char *buf, int buflen, u_char *ans, int anssiz)
{
int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
#ifdef DEBUG
char abuf[NI_MAXHOST];
#endif
#ifdef USE_POLL
highestFD = sysconf(_SC_OPEN_MAX) - 1;
@ -1021,6 +1025,8 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans,
return (resplen);
}
#ifdef DEBUG
static void
Aerror(const res_state statp, FILE *file, const char *string, int error,
const struct sockaddr *address, int alen)
@ -1055,6 +1061,8 @@ Perror(const res_state statp, FILE *file, const char *string, int error) {
errno = save;
}
#endif // DEBUG
static int
sock_eq(struct sockaddr *a, struct sockaddr *b) {
struct sockaddr_in *a4, *b4;

View File

@ -20,7 +20,7 @@
#include "port_after.h"
#define DEBUG
//#define DEBUG
#include "res_debug.h"