From 3eee1e9d04a0b9337ac03282c8483531cd21d536 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 27 May 2002 08:40:35 +0000 Subject: * unwind-ia64.c (unw_print_brmask): Don't use sprintf. (unw_print_grmask): Likewise. (unw_print_frmask): Likewise. --- binutils/ChangeLog | 6 ++++++ binutils/unwind-ia64.c | 37 ++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 01282d8..330d707 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2002-05-27 Alan Modra + + * unwind-ia64.c (unw_print_brmask): Don't use sprintf. + (unw_print_grmask): Likewise. + (unw_print_frmask): Likewise. + 2002-05-26 Kazu Hirata * arsup.c: Remove ARGSUSED. diff --git a/binutils/unwind-ia64.c b/binutils/unwind-ia64.c index 5dcd2a7..803a5fa 100644 --- a/binutils/unwind-ia64.c +++ b/binutils/unwind-ia64.c @@ -44,15 +44,18 @@ unw_print_brmask (cp, mask) char * cp; unsigned int mask; { - char *sep = ""; + int sep = 0; int i; for (i = 0; mask && (i < 5); ++i) { if (mask & 1) { - cp += sprintf (cp, "%sb%u", sep, i + 1); - sep = ","; + if (sep) + *cp++ = ','; + *cp++ = 'b'; + *cp++ = i + 1 + '0'; + sep = 1; } mask >>= 1; } @@ -64,19 +67,22 @@ unw_print_grmask (cp, mask) char * cp; unsigned int mask; { - char *sep = ""; + int sep = 0; int i; - *cp = '\0'; for (i = 0; i < 4; ++i) { if (mask & 1) { - cp += sprintf (cp, "%sr%u", sep, i + 4); - sep = ","; + if (sep) + *cp++ = ','; + *cp++ = 'r'; + *cp++ = i + 4 + '0'; + sep = 1; } mask >>= 1; } + *cp = '\0'; } static void @@ -84,19 +90,28 @@ unw_print_frmask (cp, mask) char * cp; unsigned int mask; { - char *sep = ""; + int sep = 0; int i; - *cp = '\0'; for (i = 0; i < 20; ++i) { if (mask & 1) { - cp += sprintf (cp, "%sf%u", sep, (i < 4) ? (i + 2) : (i + 12)); - sep = ","; + if (sep) + *cp++ = ','; + *cp++ = 'f'; + if (i < 4) + *cp++ = i + 2 + '0'; + else + { + *cp++ = (i + 2) / 10 + 1 + '0'; + *cp++ = (i + 2) % 10 + '0'; + } + sep = 1; } mask >>= 1; } + *cp = '\0'; } static void -- cgit v1.1