From: Roderick Schertler Date: Wed, 19 Mar 1997 17:42:50 +0000 (-0500) Subject: printf format corrections for -DDEBUGGING X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e125f273e351a19a92b69d6244af55abbbf0a26d;p=p5sagit%2Fp5-mst-13.2.git printf format corrections for -DDEBUGGING Here are some more printf format fixes. These are all in -DDEBUGGING code. p5p-msgid: 26592.858793370@eeyore.ibcinc.com --- diff --git a/doop.c b/doop.c index 7086a7b..a87f7ef 100644 --- a/doop.c +++ b/doop.c @@ -712,8 +712,10 @@ dARGS sv_setsv(tmpstr,hv_iterval(hv,entry)); SPAGAIN; DEBUG_H( { - sprintf(buf,"%d%%%d=%d\n", HeHASH(entry), - HvMAX(hv)+1, HeHASH(entry) & HvMAX(hv)); + sprintf(buf,"%lu%%%d=%lu\n", + (unsigned long)HeHASH(entry), + HvMAX(hv)+1, + (unsigned long)(HeHASH(entry) & HvMAX(hv))); sv_setpv(tmpstr,buf); } ) XPUSHs(sv_2mortal(tmpstr)); diff --git a/malloc.c b/malloc.c index 379861e..df66e90 100644 --- a/malloc.c +++ b/malloc.c @@ -328,8 +328,8 @@ malloc(nbytes) } #ifdef PERL_CORE - DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) malloc %ld bytes\n", - (unsigned long)(p+1),an++,(long)size)); + DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05lu) malloc %ld bytes\n", + (unsigned long)(p+1),(unsigned long)(an++),(long)size)); #endif /* PERL_CORE */ /* remove from linked list */ @@ -485,7 +485,7 @@ free(mp) #endif #ifdef PERL_CORE - DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) free\n",(unsigned long)cp,an++)); + DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05lu) free\n",(unsigned long)cp,(unsigned long)(an++))); #endif /* PERL_CORE */ if (cp == NULL) @@ -645,9 +645,9 @@ realloc(mp, nbytes) #ifdef PERL_CORE #ifdef DEBUGGING if (debug & 128) { - PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05d) rfree\n",(unsigned long)res,an++); - PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05d) realloc %ld bytes\n", - (unsigned long)res,an++,(long)size); + PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05lu) rfree\n",(unsigned long)res,(unsigned long)(an++)); + PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05lu) realloc %ld bytes\n", + (unsigned long)res,(unsigned long)(an++),(long)size); } #endif #endif /* PERL_CORE */ diff --git a/op.c b/op.c index 3b05012..2784a54 100644 --- a/op.c +++ b/op.c @@ -389,7 +389,7 @@ pad_sv(PADOFFSET po) { if (!po) croak("panic: pad_sv po"); - DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %d\n", po)); + DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %lu\n", (unsigned long)po)); return curpad[po]; /* eventually we'll turn this into a macro */ } @@ -407,7 +407,7 @@ pad_free(PADOFFSET po) croak("panic: pad_free curpad"); if (!po) croak("panic: pad_free po"); - DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %d\n", po)); + DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %lu\n", (unsigned long)po)); if (curpad[po] && !SvIMMORTAL(curpad[po])) SvPADTMP_off(curpad[po]); if ((I32)po < padix) @@ -426,7 +426,7 @@ pad_swipe(PADOFFSET po) croak("panic: pad_swipe curpad"); if (!po) croak("panic: pad_swipe po"); - DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %d\n", po)); + DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %lu\n", (unsigned long)po)); SvPADTMP_off(curpad[po]); curpad[po] = NEWSV(1107,0); SvPADTMP_on(curpad[po]); diff --git a/pp_ctl.c b/pp_ctl.c index 569fb4f..0a01c11 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -798,11 +798,11 @@ char *label; case CXt_LOOP: if (!cx->blk_loop.label || strNE(label, cx->blk_loop.label) ) { - DEBUG_l(deb("(Skipping label #%d %s)\n", - i, cx->blk_loop.label)); + DEBUG_l(deb("(Skipping label #%ld %s)\n", + (long)i, cx->blk_loop.label)); continue; } - DEBUG_l( deb("(Found label #%d %s)\n", i, label)); + DEBUG_l( deb("(Found label #%ld %s)\n", (long)i, label)); return i; } } @@ -837,7 +837,7 @@ I32 startingblock; continue; case CXt_EVAL: case CXt_SUB: - DEBUG_l( deb("(Found sub #%d)\n", i)); + DEBUG_l( deb("(Found sub #%ld)\n", (long)i)); return i; } } @@ -856,7 +856,7 @@ I32 startingblock; default: continue; case CXt_EVAL: - DEBUG_l( deb("(Found eval #%d)\n", i)); + DEBUG_l( deb("(Found eval #%ld)\n", (long)i)); return i; } } @@ -889,7 +889,7 @@ I32 startingblock; warn("Exiting pseudo-block via %s", op_name[op->op_type]); return -1; case CXt_LOOP: - DEBUG_l( deb("(Found loop #%d)\n", i)); + DEBUG_l( deb("(Found loop #%ld)\n", (long)i)); return i; } } diff --git a/regexec.c b/regexec.c index 2bf4030..57000cf 100644 --- a/regexec.c +++ b/regexec.c @@ -888,8 +888,8 @@ char *prog; #ifdef DEBUGGING if (regnarrate) - PerlIO_printf(Perl_debug_log, "%*s %d %lx\n", regindent*2, "", - n, (long)cc); + PerlIO_printf(Perl_debug_log, "%*s %ld %lx\n", regindent*2, "", + (long)n, (long)cc); #endif /* If degenerate scan matches "", assume scan done. */ diff --git a/sv.c b/sv.c index 224ba0a..0dc5295 100644 --- a/sv.c +++ b/sv.c @@ -3088,11 +3088,11 @@ I32 append; bp = (STDCHAR*)SvPVX(sv) + append; /* move these two too to registers */ ptr = (STDCHAR*)PerlIO_get_ptr(fp); DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: entering, ptr=%d, cnt=%d\n",ptr,cnt)); + "Screamer: entering, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt)); DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: entering: FILE * thinks ptr=%d, cnt=%d, base=%d\n", - PerlIO_get_ptr(fp), PerlIO_get_cnt(fp), - PerlIO_has_base(fp) ? PerlIO_get_base(fp) : 0)); + "Screamer: entering: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n", + (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp), + (long)(PerlIO_has_base(fp) ? PerlIO_get_base(fp) : 0))); for (;;) { screamer: if (cnt > 0) { @@ -3122,24 +3122,24 @@ I32 append; } DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: going to getc, ptr=%d, cnt=%d\n",ptr,cnt)); + "Screamer: going to getc, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt)); PerlIO_set_ptrcnt(fp, ptr, cnt); /* deregisterize cnt and ptr */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: pre: FILE * thinks ptr=%d, cnt=%d, base=%d\n", - PerlIO_get_ptr(fp), PerlIO_get_cnt(fp), - PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0)); + "Screamer: pre: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n", + (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp), + (long)(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); /* This used to call 'filbuf' in stdio form, but as that behaves like getc when cnt <= 0 we use PerlIO_getc here to avoid introducing another abstraction. */ i = PerlIO_getc(fp); /* get more characters */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: post: FILE * thinks ptr=%d, cnt=%d, base=%d\n", - PerlIO_get_ptr(fp), PerlIO_get_cnt(fp), - PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0)); + "Screamer: post: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n", + (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp), + (long)(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); cnt = PerlIO_get_cnt(fp); ptr = (STDCHAR*)PerlIO_get_ptr(fp); /* reregisterize cnt and ptr */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: after getc, ptr=%d, cnt=%d\n",ptr,cnt)); + "Screamer: after getc, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt)); if (i == EOF) /* all done for ever? */ goto thats_really_all_folks; @@ -3163,12 +3163,12 @@ thats_really_all_folks: if (shortbuffered) cnt += shortbuffered; DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: quitting, ptr=%d, cnt=%d\n",ptr,cnt)); + "Screamer: quitting, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt)); PerlIO_set_ptrcnt(fp, ptr, cnt); /* put these back or we're in trouble */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: end: FILE * thinks ptr=%d, cnt=%d, base=%d\n", - PerlIO_get_ptr(fp), PerlIO_get_cnt(fp), - PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0)); + "Screamer: end: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n", + (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp), + (long)(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); *bp = '\0'; SvCUR_set(sv, bp - (STDCHAR*)SvPVX(sv)); /* set length */ DEBUG_P(PerlIO_printf(Perl_debug_log, diff --git a/x2p/str.c b/x2p/str.c index 634be18..88b3c60 100644 --- a/x2p/str.c +++ b/x2p/str.c @@ -41,7 +41,7 @@ register STR *str; str->str_pok = 1; #ifdef DEBUGGING if (debug & 32) - fprintf(stderr,"0x%lx ptr(%s)\n",str,str->str_ptr); + fprintf(stderr,"0x%lx ptr(%s)\n",(unsigned long)str,str->str_ptr); #endif return str->str_ptr; } @@ -59,7 +59,7 @@ register STR *str; str->str_nok = 1; #ifdef DEBUGGING if (debug & 32) - fprintf(stderr,"0x%lx num(%g)\n",str,str->str_nval); + fprintf(stderr,"0x%lx num(%g)\n",(unsigned long)str,str->str_nval); #endif return str->str_nval; } diff --git a/x2p/util.c b/x2p/util.c index c70bab9..e8b666f 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -33,7 +33,8 @@ MEM_SIZE size; ptr = malloc(size ? size : 1); #ifdef DEBUGGING if (debug & 128) - fprintf(stderr,"0x%x: (%05d) malloc %d bytes\n",ptr,an++,size); + fprintf(stderr,"0x%lx: (%05d) malloc %d bytes\n",(unsigned long)ptr, + an++,size); #endif if (ptr != Nullch) return ptr; @@ -57,8 +58,8 @@ MEM_SIZE size; ptr = realloc(where, size ? size : 1); #ifdef DEBUGGING if (debug & 128) { - fprintf(stderr,"0x%x: (%05d) rfree\n",where,an++); - fprintf(stderr,"0x%x: (%05d) realloc %d bytes\n",ptr,an++,size); + fprintf(stderr,"0x%lx: (%05d) rfree\n",(unsigned long)where,an++); + fprintf(stderr,"0x%lx: (%05d) realloc %d bytes\n",(unsigned long)ptr,an++,size); } #endif if (ptr != Nullch) @@ -78,7 +79,7 @@ Malloc_t where; { #ifdef DEBUGGING if (debug & 128) - fprintf(stderr,"0x%x: (%05d) free\n",where,an++); + fprintf(stderr,"0x%lx: (%05d) free\n",(unsigned long)where,an++); #endif free(where); }