summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-20 08:16:02 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-20 08:16:02 +0000
commit6bf964e1a60fa5bb711b214d387c6f288b402685 (patch)
tree7610e2c4e46a548fb1b27e759a91a35d43f5df28 /malloc.c
parent066d1a89330dfaa74b5c19223bbd3a266ca4fab3 (diff)
downloadperl-6bf964e1a60fa5bb711b214d387c6f288b402685.tar.gz
Don't do sprintf().
p4raw-id: //depot/perl@19833
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/malloc.c b/malloc.c
index 0e6e6420a7..b080444e7c 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();