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; \
}

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 {}

View File

@ -108,7 +108,7 @@
/*% Options. Should all be left alone. */
#define RESOLVSORT
#define DEBUG
//#define DEBUG
#ifdef SOLARIS2
#include <sys/systeminfo.h>

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 *);

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"