aboutsummaryrefslogtreecommitdiff
path: root/malloc/mtrace.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-29 15:31:47 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-29 15:31:47 +0000
commitd5cabaa4b0ef1f389d31db6ff0b8029c60c25df2 (patch)
tree4326d04ba4ee61f932a2cbc95f0ef81a343d8cc7 /malloc/mtrace.c
parentc5e340c71ba6f4563ca5fa245baa82b6363ddb2e (diff)
downloadglibc-d5cabaa4b0ef1f389d31db6ff0b8029c60c25df2.zip
glibc-d5cabaa4b0ef1f389d31db6ff0b8029c60c25df2.tar.gz
glibc-d5cabaa4b0ef1f389d31db6ff0b8029c60c25df2.tar.bz2
Update.
* malloc/mtrace.c (tr_where): Replace snprintf call by mempcpy and _fitoa.
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r--malloc/mtrace.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 8dd711a..d15569c 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -32,14 +32,11 @@
#include <stdio.h>
#include <string.h>
-
-#ifndef __GNU_LIBRARY__
-extern char *getenv ();
-#else
#include <stdlib.h>
-#endif
-#if defined _LIBC && defined USE_IN_LIBIO
+#include <stdio-common/_itoa.h>
+
+#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define setvbuf(s, b, f, l) _IO_setvbuf (s, b, f, l)
#endif
@@ -99,14 +96,19 @@ tr_where (caller)
char *buf = (char *) "";
if (info.dli_sname && info.dli_sname[0])
{
- size_t len = strlen (info.dli_sname) + 22;
- buf = alloca (len);
- if (caller >= (const __ptr_t) info.dli_saddr)
- snprintf (buf, len, "(%s+0x%x)", info.dli_sname,
- caller - (const __ptr_t) info.dli_saddr);
- else
- snprintf (buf, len, "(%s-0x%x)", info.dli_sname,
- (const __ptr_t) info.dli_saddr - caller);
+ size_t len = strlen (info.dli_sname);
+ buf = alloca (len + 6 + 2 * sizeof (void *));
+
+ buf[0] = '(';
+ __stpcpy (_fitoa (caller >= (const __ptr_t) info.dli_saddr
+ ? caller - (const __ptr_t) info.dli_saddr
+ : (const __ptr_t) info.dli_saddr - caller,
+ __stpcpy (__mempcpy (buf + 1, info.dli_sname,
+ len),
+ caller >= (__ptr_t) info.dli_saddr
+ ? "+0x" : "-0x"),
+ 16, 0),
+ ")");
}
fprintf (mallstream, "@ %s%s%s[%p] ",