From 0a1b1120ff30703ff6e661a7b7901380f0ce4192 Mon Sep 17 00:00:00 2001 From: Jeffrey Hutzelman Date: Mon, 18 Mar 2013 00:19:59 -0400 Subject: Dewarn with -DDEBUG It's sort of nice to be able to build with debugging. --- server/dispatch.c | 8 -------- server/realm.c | 3 ++- zhm/queue.c | 6 +++--- zhm/zhm.c | 6 ++++++ zwgc/mux.c | 5 +++-- zwgc/new_memory.c | 15 ++++++++------- zwgc/new_memory.h | 8 ++++---- zwgc/xselect.c | 2 +- zwgc/xshow.c | 2 +- 9 files changed, 28 insertions(+), 27 deletions(-) diff --git a/server/dispatch.c b/server/dispatch.c index b1909e0..ea95d3a 100644 --- a/server/dispatch.c +++ b/server/dispatch.c @@ -36,11 +36,6 @@ nacktab_hashval(struct sockaddr_in sa, ZUnique_Id_t uid) { #define HOSTS_SIZE_INIT 256 -#ifdef DEBUG -const char *ZNoticeKinds[9] = {"UNSAFE", "UNACKED", "ACKED", "HMACK", - "HMCTL", "SERVACK", "SERVNAK", "CLIENTACK", - "STAT"}; -#endif /* * * External Routines: @@ -239,9 +234,6 @@ dispatch(ZNotice_t *notice, int authflag; ZRealm *realm; char *cp; -#ifdef DEBUG - char dbg_buf[BUFSIZ]; -#endif authflag = (auth == ZAUTH_YES); diff --git a/server/realm.c b/server/realm.c index f4ccabd..4f9ce2f 100644 --- a/server/realm.c +++ b/server/realm.c @@ -880,7 +880,8 @@ realm_control_dispatch(ZNotice_t *notice, ack(notice, who); } } else if (!strcmp(opcode, REALM_BOOT)) { - zdbug((LOG_DEBUG, "got a REALM_BOOT from %d (me %d)", server, me_server)); + zdbug((LOG_DEBUG, "got a REALM_BOOT from %s", + inet_ntoa(server->addr.sin_addr))); realm->state = REALM_STARTING; realm_set_server(who, realm); #ifdef REALM_MGMT diff --git a/zhm/queue.c b/zhm/queue.c index 20679b0..333bf3e 100644 --- a/zhm/queue.c +++ b/zhm/queue.c @@ -37,7 +37,7 @@ static void queue_timeout(void *arg); int rexmit_times[] = { 2, 2, 4, 4, 8, -1 }; #ifdef DEBUG -Code_t dump_queue(void); +static void dump_queue(void); #endif void @@ -172,11 +172,11 @@ disable_queue_retransmits(void) } #ifdef DEBUG -static Code_t +static void dump_queue(void) { Queue *entry; - void *mp; + char *mp; int ml; DPR("Dumping queue...\n"); diff --git a/zhm/zhm.c b/zhm/zhm.c index cbdcf6d..ec4696b 100644 --- a/zhm/zhm.c +++ b/zhm/zhm.c @@ -46,7 +46,9 @@ static RETSIGTYPE deactivate(int); static RETSIGTYPE terminate(int); static void choose_server(void); static void init_hm(void); +#ifndef DEBUG static void detach(void); +#endif static void send_stats(ZNotice_t *, struct sockaddr_in *); static char *strsave(const char *); @@ -361,7 +363,9 @@ init_hm(void) { struct servent *sp; Code_t ret; +#ifndef DEBUG FILE *fp; +#endif #ifdef _POSIX_VERSION struct sigaction sa; #endif @@ -458,6 +462,7 @@ init_hm(void) #endif } +#ifndef DEBUG static void detach(void) { @@ -497,6 +502,7 @@ detach(void) setsid(); #endif } +#endif static char version[BUFSIZ]; diff --git a/zwgc/mux.c b/zwgc/mux.c index 55d5e3e..a7b2210 100644 --- a/zwgc/mux.c +++ b/zwgc/mux.c @@ -210,8 +210,9 @@ mux_loop(void) #ifdef DEBUG if (zwgc_debug) fprintf(stderr, - "mux_loop...activity on fd %d, calling %x(%x)\n", - i,input_handler[i],input_handler_arg[i]); + "mux_loop...activity on fd %d, calling %lx(%lx)\n", + i, (unsigned long)input_handler[i], + (unsigned long)input_handler_arg[i]); #endif input_handler[i](input_handler_arg[i]); } diff --git a/zwgc/new_memory.c b/zwgc/new_memory.c index 30adfd1..7ceab2d 100644 --- a/zwgc/new_memory.c +++ b/zwgc/new_memory.c @@ -61,7 +61,7 @@ int current_line = -1; * string_Copy("foo"). */ -char *memory__malloc(size) +void *memory__malloc(size) unsigned size; { char *result; @@ -84,11 +84,11 @@ char *memory__malloc(size) return(result); } -char *memory__realloc(ptr, size) - char *ptr; +void *memory__realloc(aptr, size) + void *aptr; unsigned size; { - char *result; + char *result, *ptr = aptr; assert(ptr); @@ -108,7 +108,7 @@ char *memory__realloc(ptr, size) return(result+memory__size_of_header); } -char *memory__calloc(nelem, elsize) +void *memory__calloc(nelem, elsize) unsigned nelem; unsigned elsize; { @@ -131,9 +131,10 @@ char *memory__calloc(nelem, elsize) return(result); } -void memory__free(ptr) - char *ptr; +void memory__free(aptr) + void *aptr; { + char *ptr = aptr; assert(ptr); #ifdef DEBUG_MEMORY diff --git a/zwgc/new_memory.h b/zwgc/new_memory.h index f10ac9c..31235fb 100644 --- a/zwgc/new_memory.h +++ b/zwgc/new_memory.h @@ -17,10 +17,10 @@ #ifndef memory_MODULE #define memory_MODULE -extern char *memory__malloc(); /* PRIVATE */ -extern char *memory__realloc(); /* PRIVATE */ -extern char *memory__calloc(); /* PRIVATE */ -extern void memory__free(); /* PRIVATE */ +extern void *memory__malloc(unsigned); /* PRIVATE */ +extern void *memory__realloc(void *, unsigned); /* PRIVATE */ +extern void *memory__calloc(unsigned, unsigned); /* PRIVATE */ +extern void memory__free(void *); /* PRIVATE */ #ifdef DEBUG_MEMORY diff --git a/zwgc/xselect.c b/zwgc/xselect.c index 89f594d..45ac997 100644 --- a/zwgc/xselect.c +++ b/zwgc/xselect.c @@ -127,7 +127,7 @@ xselSetProperties(Display *dpy, spec (or if this program is buggy), but it could happen */ #ifdef DEBUG fprintf(stderr, - "SelectionRequest event received for unowned selection: requestor wid=0x%x", w); + "SelectionRequest event received for unowned selection: requestor wid=0x%lx", (unsigned long)w); #endif ChangeProp(XA_STRING,8,"",0); } diff --git a/zwgc/xshow.c b/zwgc/xshow.c index 3e1b2ce..afe1037 100644 --- a/zwgc/xshow.c +++ b/zwgc/xshow.c @@ -621,7 +621,7 @@ x_get_input(Display *dpy) { XEvent event; - dprintf1("Entering x_get_input(%x).\n",dpy); + dprintf1("Entering x_get_input(%lx).\n",(unsigned long)dpy); /* * Kludge to get around lossage in XPending: -- cgit v1.2.3