From 1f5b4821240bfb931292514d9da649eab05fa753 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 5 Nov 2002 20:37:20 +0000 Subject: (inttostr): Remove; use new imaxtostr library function instead. --- src/expr.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/expr.c b/src/expr.c index 6b705d467..9b0cb99a5 100644 --- a/src/expr.c +++ b/src/expr.c @@ -37,6 +37,7 @@ #include "long-options.h" #include "error.h" #include "closeout.h" +#include "inttostr.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "expr" @@ -224,25 +225,6 @@ freev (VALUE *v) OLD (v); } -/* Store a printable representation of I somewhere into BUF, and - return a pointer to the stored representation. */ - -static char * -inttostr (intmax_t i, char buf[INT_STRLEN_BOUND (intmax_t) + 1]) -{ - uintmax_t ui = i; - char *p = buf + INT_STRLEN_BOUND (intmax_t); - *p = '\0'; - if (i < 0) - ui = -ui; - do - *--p = '0' + ui % 10; - while ((ui /= 10) != 0); - if (i < 0) - *--p = '-'; - return p; -} - /* Print VALUE V. */ static void @@ -254,7 +236,7 @@ printv (VALUE *v) switch (v->type) { case integer: - p = inttostr (v->u.i, buf); + p = imaxtostr (v->u.i, buf); break; case string: p = v->u.s; @@ -292,7 +274,7 @@ tostring (VALUE *v) switch (v->type) { case integer: - v->u.s = xstrdup (inttostr (v->u.i, buf)); + v->u.s = xstrdup (imaxtostr (v->u.i, buf)); v->type = string; break; case string: -- cgit v1.2.3-70-g09d2