From 74324c86663f57a19c1de303ee8c8e5449db9ef2 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 4 Jun 2007 10:16:52 +0000 Subject: Audit bb_common_bufsiz usage, add script which looks for misuse. tr: stop using globals needlessly. code: -103 bytes --- coreutils/date.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'coreutils/date.c') diff --git a/coreutils/date.c b/coreutils/date.c index 57c826a3f..cec8854ff 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -222,9 +222,10 @@ int date_main(int argc, char **argv) date_fmt = (char*)"%a %b %e %H:%M:%S %Z %Y"; } +#define date_buf bb_common_bufsiz1 if (*date_fmt == '\0') { /* With no format string, just print a blank line */ - *bb_common_bufsiz1 = 0; + date_buf[0] = '\0'; } else { /* Handle special conversions */ @@ -233,9 +234,9 @@ int date_main(int argc, char **argv) } /* Generate output string */ - strftime(bb_common_bufsiz1, 200, date_fmt, &tm_time); + strftime(date_buf, sizeof(date_buf), date_fmt, &tm_time); } - puts(bb_common_bufsiz1); + puts(date_buf); return EXIT_SUCCESS; } -- cgit v1.2.3-55-g6feb