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:
parent
efccf04aaf
commit
51974c5df0
@ -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.
|
* 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"
|
#include "port_before.h"
|
||||||
|
|
||||||
@ -56,21 +58,21 @@ static char *debugFuncs[256];
|
|||||||
# define ENTER(proc) { \
|
# define ENTER(proc) { \
|
||||||
debugFuncs[debugDepth] = proc; \
|
debugFuncs[debugDepth] = proc; \
|
||||||
fprintf(stderr, "ENTER(%d:%s.%s)\n", \
|
fprintf(stderr, "ENTER(%d:%s.%s)\n", \
|
||||||
debugDepth, DEBUG, \
|
debugDepth, DEBUG_DOMAIN, \
|
||||||
debugFuncs[debugDepth]); \
|
debugFuncs[debugDepth]); \
|
||||||
debugDepth++; \
|
debugDepth++; \
|
||||||
}
|
}
|
||||||
# define RET(value) { \
|
# define RET(value) { \
|
||||||
debugDepth--; \
|
debugDepth--; \
|
||||||
fprintf(stderr, "RET(%d:%s.%s)\n", \
|
fprintf(stderr, "RET(%d:%s.%s)\n", \
|
||||||
debugDepth, DEBUG, \
|
debugDepth, DEBUG_DOMAIN, \
|
||||||
debugFuncs[debugDepth]); \
|
debugFuncs[debugDepth]); \
|
||||||
return (value); \
|
return (value); \
|
||||||
}
|
}
|
||||||
# define RETV { \
|
# define RETV { \
|
||||||
debugDepth--; \
|
debugDepth--; \
|
||||||
fprintf(stderr, "RETV(%d:%s.%s)\n", \
|
fprintf(stderr, "RETV(%d:%s.%s)\n", \
|
||||||
debugDepth, DEBUG, \
|
debugDepth, DEBUG_DOMAIN, \
|
||||||
debugFuncs[debugDepth]); \
|
debugFuncs[debugDepth]); \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
@ -99,7 +101,7 @@ tree_init(tree **ppr_tree) {
|
|||||||
*ppr_tree = NULL;
|
*ppr_tree = NULL;
|
||||||
RETV
|
RETV
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_t
|
tree_t
|
||||||
tree_srch(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t), tree_t p_user) {
|
tree_srch(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t), tree_t p_user) {
|
||||||
ENTER("tree_srch")
|
ENTER("tree_srch")
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
# define Dprint(cond, args) /*empty*/
|
# define Dprint(cond, args) /*empty*/
|
||||||
# define DprintQ(cond, args, query, size) /*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*/
|
# define Perror(statp, file, string, error) /*empty*/
|
||||||
#else
|
#else
|
||||||
# define Dprint(cond, args) if (cond) {fprintf args;} else {}
|
# define Dprint(cond, args) if (cond) {fprintf args;} else {}
|
||||||
@ -31,5 +31,5 @@
|
|||||||
} else {}
|
} else {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _RES_DEBUG_H_ */
|
#endif /* _RES_DEBUG_H_ */
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1985, 1989, 1993
|
* Copyright (c) 1985, 1989, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@ -17,7 +17,7 @@
|
|||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 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
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@ -33,14 +33,14 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
* copyright notice and this permission notice appear in all copies, and that
|
* copyright notice and this permission notice appear in all copies, and that
|
||||||
* the name of Digital Equipment Corporation not be used in advertising or
|
* the name of Digital Equipment Corporation not be used in advertising or
|
||||||
* publicity pertaining to distribution of the document or software without
|
* publicity pertaining to distribution of the document or software without
|
||||||
* specific, written prior permission.
|
* specific, written prior permission.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
||||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
||||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
||||||
@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
/*% Options. Should all be left alone. */
|
/*% Options. Should all be left alone. */
|
||||||
#define RESOLVSORT
|
#define RESOLVSORT
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
#ifdef SOLARIS2
|
#ifdef SOLARIS2
|
||||||
#include <sys/systeminfo.h>
|
#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
|
* 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,
|
* 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
|
* 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
|
* install local static routes through 127.0.0.1 for all your network
|
||||||
* interfaces, that we could solve this problem without a code change.
|
* 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)) {
|
if (inet_aton(net, &a)) {
|
||||||
statp->sort_list[nsort].mask = a.s_addr;
|
statp->sort_list[nsort].mask = a.s_addr;
|
||||||
} else {
|
} else {
|
||||||
statp->sort_list[nsort].mask =
|
statp->sort_list[nsort].mask =
|
||||||
net_mask(statp->sort_list[nsort].addr);
|
net_mask(statp->sort_list[nsort].addr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
statp->sort_list[nsort].mask =
|
statp->sort_list[nsort].mask =
|
||||||
net_mask(statp->sort_list[nsort].addr);
|
net_mask(statp->sort_list[nsort].addr);
|
||||||
}
|
}
|
||||||
nsort++;
|
nsort++;
|
||||||
@ -459,7 +459,7 @@ __res_vinit(res_state statp, int preinit) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nserv > 0)
|
if (nserv > 0)
|
||||||
statp->nscount = nserv;
|
statp->nscount = nserv;
|
||||||
#ifdef RESOLVSORT
|
#ifdef RESOLVSORT
|
||||||
statp->nsort = nsort;
|
statp->nsort = nsort;
|
||||||
@ -711,7 +711,7 @@ void
|
|||||||
res_nclose(res_state statp) {
|
res_nclose(res_state statp) {
|
||||||
int ns;
|
int ns;
|
||||||
|
|
||||||
if (statp->_vcsock >= 0) {
|
if (statp->_vcsock >= 0) {
|
||||||
(void) close(statp->_vcsock);
|
(void) close(statp->_vcsock);
|
||||||
statp->_vcsock = -1;
|
statp->_vcsock = -1;
|
||||||
statp->_flags &= ~(RES_F_VC | RES_F_CONN);
|
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++;
|
set++;
|
||||||
}
|
}
|
||||||
statp->nscount = nserv;
|
statp->nscount = nserv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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++) {
|
for (i = 0; i < statp->nscount && i < cnt; i++) {
|
||||||
if (statp->_u._ext.ext)
|
if (statp->_u._ext.ext)
|
||||||
family = statp->_u._ext.ext->nsaddrs[i].sin.sin_family;
|
family = statp->_u._ext.ext->nsaddrs[i].sin.sin_family;
|
||||||
else
|
else
|
||||||
family = statp->nsaddr_list[i].sin_family;
|
family = statp->nsaddr_list[i].sin_family;
|
||||||
|
|
||||||
switch (family) {
|
switch (family) {
|
||||||
|
@ -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"
|
#include "port_after.h"
|
||||||
|
|
||||||
/* Options. Leave them on. */
|
/* Options. Leave them on. */
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
extern const char *_res_opcodes[];
|
extern const char *_res_opcodes[];
|
||||||
|
|
||||||
|
@ -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"
|
#include "port_after.h"
|
||||||
|
|
||||||
/* Options. Leave them on. */
|
/* Options. Leave them on. */
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
#define MAXPORT 1024
|
#define MAXPORT 1024
|
||||||
|
|
||||||
static int getnum_str(u_char **, u_char *);
|
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
|
* Returns the size of the resulting packet if no error
|
||||||
*
|
*
|
||||||
* On error,
|
* On error,
|
||||||
* returns
|
* returns
|
||||||
*\li -1 if error in reading a word/number in rdata
|
*\li -1 if error in reading a word/number in rdata
|
||||||
* portion for update packets
|
* portion for update packets
|
||||||
*\li -2 if length of buffer passed is insufficient
|
*\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);
|
return (-1);
|
||||||
ShrinkBuffer(1);
|
ShrinkBuffer(1);
|
||||||
*cp++ = i & 0xff;
|
*cp++ = i & 0xff;
|
||||||
|
|
||||||
for (i = 0; i < MAXPORT/8 ; i++)
|
for (i = 0; i < MAXPORT/8 ; i++)
|
||||||
bm[i] = 0;
|
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);
|
n = (u_int16_t)((cp - sp2) - INT16SZ);
|
||||||
PUTSHORT(n, sp2);
|
PUTSHORT(n, sp2);
|
||||||
} /*for*/
|
} /*for*/
|
||||||
|
|
||||||
hp->qdcount = htons(counts[0]);
|
hp->qdcount = htons(counts[0]);
|
||||||
hp->ancount = htons(counts[1]);
|
hp->ancount = htons(counts[1]);
|
||||||
hp->nscount = htons(counts[2]);
|
hp->nscount = htons(counts[2]);
|
||||||
@ -721,7 +721,7 @@ static int
|
|||||||
getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
|
getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
|
||||||
char *cp;
|
char *cp;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
for (cp = buf; *startpp <= endp; ) {
|
for (cp = buf; *startpp <= endp; ) {
|
||||||
c = **startpp;
|
c = **startpp;
|
||||||
if (isspace(c) || c == '\0') {
|
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 seen_quote = 0;
|
||||||
int escape = 0;
|
int escape = 0;
|
||||||
int dig = 0;
|
int dig = 0;
|
||||||
|
|
||||||
for (cp = buf; *startpp <= endp; ) {
|
for (cp = buf; *startpp <= endp; ) {
|
||||||
if ((c = **startpp) == '\0')
|
if ((c = **startpp) == '\0')
|
||||||
break;
|
break;
|
||||||
@ -773,7 +773,7 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
|
|||||||
c1 = 0;
|
c1 = 0;
|
||||||
(*startpp)++;
|
(*startpp)++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
goto do_escape;
|
goto do_escape;
|
||||||
case '"':
|
case '"':
|
||||||
if (!escape) {
|
if (!escape) {
|
||||||
@ -797,7 +797,7 @@ getstr_str(char *buf, int size, u_char **startpp, u_char *endp) {
|
|||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
c1 = c1 * 10 +
|
c1 = c1 * 10 +
|
||||||
(strchr(digits, c) - digits);
|
(strchr(digits, c) - digits);
|
||||||
|
|
||||||
if (++dig == 3) {
|
if (++dig == 3) {
|
||||||
@ -858,7 +858,7 @@ gethexnum_str(u_char **startpp, u_char *endp) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
(*startpp)++;
|
(*startpp)++;
|
||||||
if (isdigit(c))
|
if (isdigit(c))
|
||||||
n = n * 16 + (c - '0');
|
n = n * 16 + (c - '0');
|
||||||
@ -903,7 +903,7 @@ getnum_str(u_char **startpp, u_char *endp) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
(*startpp)++;
|
(*startpp)++;
|
||||||
n = n * 10 + (c - '0');
|
n = n * 10 + (c - '0');
|
||||||
seendigit = 1;
|
seendigit = 1;
|
||||||
|
@ -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"
|
#include "port_after.h"
|
||||||
|
|
||||||
/* Options. Leave them on. */
|
/* Options. Leave them on. */
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
#if PACKETSZ > 1024
|
#if PACKETSZ > 1024
|
||||||
#define MAXPACKET PACKETSZ
|
#define MAXPACKET PACKETSZ
|
||||||
|
@ -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 */
|
#endif /* USE_POLL */
|
||||||
|
|
||||||
/* Options. Leave them on. */
|
/* Options. Leave them on. */
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
#include "res_debug.h"
|
#include "res_debug.h"
|
||||||
#include "res_private.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,
|
static int send_dg(res_state, const u_char *, int,
|
||||||
u_char *, int, int *, int, int,
|
u_char *, int, int *, int, int,
|
||||||
int *, int *);
|
int *, int *);
|
||||||
|
#ifdef DEBUG
|
||||||
static void Aerror(const res_state, FILE *, const char *, int,
|
static void Aerror(const res_state, FILE *, const char *, int,
|
||||||
const struct sockaddr *, int);
|
const struct sockaddr *, int);
|
||||||
static void Perror(const res_state, FILE *, const char *, int);
|
static void Perror(const res_state, FILE *, const char *, int);
|
||||||
|
#endif // DEBUG
|
||||||
static int sock_eq(struct sockaddr *, struct sockaddr *);
|
static int sock_eq(struct sockaddr *, struct sockaddr *);
|
||||||
#if defined(NEED_PSELECT) && !defined(USE_POLL)
|
#if defined(NEED_PSELECT) && !defined(USE_POLL)
|
||||||
static int pselect(int, void *, void *, void *,
|
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)
|
const u_char *buf, int buflen, u_char *ans, int anssiz)
|
||||||
{
|
{
|
||||||
int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
|
int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
|
||||||
|
#ifdef DEBUG
|
||||||
char abuf[NI_MAXHOST];
|
char abuf[NI_MAXHOST];
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_POLL
|
#ifdef USE_POLL
|
||||||
highestFD = sysconf(_SC_OPEN_MAX) - 1;
|
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);
|
return (resplen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Aerror(const res_state statp, FILE *file, const char *string, int error,
|
Aerror(const res_state statp, FILE *file, const char *string, int error,
|
||||||
const struct sockaddr *address, int alen)
|
const struct sockaddr *address, int alen)
|
||||||
@ -1055,6 +1061,8 @@ Perror(const res_state statp, FILE *file, const char *string, int error) {
|
|||||||
errno = save;
|
errno = save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sock_eq(struct sockaddr *a, struct sockaddr *b) {
|
sock_eq(struct sockaddr *a, struct sockaddr *b) {
|
||||||
struct sockaddr_in *a4, *b4;
|
struct sockaddr_in *a4, *b4;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "port_after.h"
|
#include "port_after.h"
|
||||||
|
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
#include "res_debug.h"
|
#include "res_debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user