From dc83e39a08d677865d9b89a54632a7a7b02204a3 Mon Sep 17 00:00:00 2001 From: John Millaway Date: Thu, 22 Dec 2005 00:24:19 +0000 Subject: [PATCH] Improvement request 1069716 log vs. log10 --- buf.c | 2 +- main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buf.c b/buf.c index 647be69..fb3bbd1 100644 --- a/buf.c +++ b/buf.c @@ -89,7 +89,7 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno) { char *t, *fmt = "#line %d \"%s\"\n"; - t = flex_alloc (strlen (fmt) + strlen (filename) + (int)(1 + log(lineno>=0?lineno:-lineno)/log(10)) + 1); + t = flex_alloc (strlen (fmt) + strlen (filename) + (int)(1 + log10(lineno>=0?lineno:-lineno)) + 1); sprintf (t, fmt, lineno, filename); buf = buf_strappend (buf, t); flex_free (t); diff --git a/main.c b/main.c index f5f1812..c8ea638 100644 --- a/main.c +++ b/main.c @@ -436,7 +436,7 @@ void check_options () for (i = 1; i <= lastsc; i++) { char *str, *fmt = "#define %s %d\n"; - str = (char*)flex_alloc(strlen(fmt) + strlen(scname[i]) + (int)(1 + log(i)/log(10)) + 2); + str = (char*)flex_alloc(strlen(fmt) + strlen(scname[i]) + (int)(1 + log10(i)) + 2); sprintf(str, fmt, scname[i], i - 1); buf_strappend(&tmpbuf, str); free(str); -- 2.40.0