Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/ntp/dist/libntp Use separate variables for the ...
details: https://anonhg.NetBSD.org/src/rev/341c2c3b66c3
branches: trunk
changeset: 325652:341c2c3b66c3
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Jan 02 18:26:03 2014 +0000
description:
Use separate variables for the format strings to get working format
string checking with both GCC and Clang.
diffstat:
external/bsd/ntp/dist/libntp/prettydate.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (40 lines):
diff -r d66c7a18533c -r 341c2c3b66c3 external/bsd/ntp/dist/libntp/prettydate.c
--- a/external/bsd/ntp/dist/libntp/prettydate.c Thu Jan 02 18:04:28 2014 +0000
+++ b/external/bsd/ntp/dist/libntp/prettydate.c Thu Jan 02 18:26:03 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prettydate.c,v 1.2 2013/12/28 03:20:13 christos Exp $ */
+/* $NetBSD: prettydate.c,v 1.3 2014/01/02 18:26:03 joerg Exp $ */
/*
* prettydate - convert a time stamp to something readable
@@ -159,10 +159,10 @@
int local
)
{
- static const char* pfmt[2] = {
- "%08lx.%08lx %s, %s %2d %4d %2d:%02d:%02d.%03u",
- "%08lx.%08lx [%s, %s %2d %4d %2d:%02d:%02d.%03u UTC]"
- };
+ static const char pfmt0[] =
+ "%08lx.%08lx %s, %s %2d %4d %2d:%02d:%02d.%03u";
+ static const char pfmt1[] =
+ "%08lx.%08lx [%s, %s %2d %4d %2d:%02d:%02d.%03u UTC]";
char *bp;
struct tm *tm;
@@ -188,13 +188,13 @@
*/
struct calendar jd;
ntpcal_time_to_date(&jd, &sec);
- snprintf(bp, LIB_BUFLENGTH, pfmt[local != 0],
+ snprintf(bp, LIB_BUFLENGTH, local ? pfmt1 : pfmt0,
(u_long)ts->l_ui, (u_long)ts->l_uf,
daynames[jd.weekday], months[jd.month-1],
jd.monthday, jd.year, jd.hour,
jd.minute, jd.second, msec);
} else
- snprintf(bp, LIB_BUFLENGTH, pfmt[0],
+ snprintf(bp, LIB_BUFLENGTH, pfmt0,
(u_long)ts->l_ui, (u_long)ts->l_uf,
daynames[tm->tm_wday], months[tm->tm_mon],
tm->tm_mday, 1900 + tm->tm_year, tm->tm_hour,
Home |
Main Index |
Thread Index |
Old Index