From: Jarkko Hietaniemi Date: Fri, 20 Jun 2003 08:16:02 +0000 (+0000) Subject: Don't do sprintf(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6bf964e1a60fa5bb711b214d387c6f288b402685;p=p5sagit%2Fp5-mst-13.2.git Don't do sprintf(). p4raw-id: //depot/perl@19833 --- diff --git a/malloc.c b/malloc.c index 0e6e642..b080444 100644 --- a/malloc.c +++ b/malloc.c @@ -1269,8 +1269,6 @@ botch(char *diag, char *s, char *file, int line) goto do_write; else { dTHX; - char linebuf[10]; - if (PerlIO_printf(PerlIO_stderr(), "assertion botched (%s?): %s%s %s:%d\n", diag, s, file, line) != 0) { @@ -1282,8 +1280,16 @@ botch(char *diag, char *s, char *file, int line) write2(" ("); write2(file); write2(":"); - sprintf(linebuf, "%d", line); - write2(linebuf); + { + char linebuf[10]; + char *s = linebuf + sizeof(linebuf) - 1; + int n = line; + *s = 0; + do { + *--s = '0' + (n % 10); + } while (n /= 10); + write2(s); + } write2(")\n"); } PerlProc_abort();