Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/ipf/tools define the format as a constant so that we do...



details:   https://anonhg.NetBSD.org/src/rev/ca5c9c585b50
branches:  trunk
changeset: 762627:ca5c9c585b50
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 24 14:33:23 2011 +0000

description:
define the format as a constant so that we don't break if sprintf is a macro.
XXX: make it so that sprintf is not a macro.

diffstat:

 dist/ipf/tools/ipmon.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 06c461c964d7 -r ca5c9c585b50 dist/ipf/tools/ipmon.c
--- a/dist/ipf/tools/ipmon.c    Thu Feb 24 14:22:04 2011 +0000
+++ b/dist/ipf/tools/ipmon.c    Thu Feb 24 14:33:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipmon.c,v 1.16 2009/08/19 08:35:32 darrenr Exp $       */
+/*     $NetBSD: ipmon.c,v 1.17 2011/02/24 14:33:23 christos Exp $      */
 
 /*
  * Copyright (C) 2001-2006 by Darren Reed.
@@ -904,7 +904,7 @@
                t += strlen(t);
        }
        if (sl->isl_type != ISL_NEW) {
-               sprintf(t,
+               static const char fmt[] =
 #ifdef USE_QUAD_T
 #ifdef PRId64
                        " Forward: Pkts in %" PRId64 " Bytes in %" PRId64
@@ -912,11 +912,12 @@
                        " Backward: Pkts in %" PRId64 " Bytes in %" PRId64
                        " Pkts out %" PRId64 " Bytes out %" PRId64,
 #else
-                       " Forward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd Backward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd",
+                       " Forward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd Backward: Pkts in %qd Bytes in %qd Pkts out %qd Bytes out %qd";
 #endif /* PRId64 */
 #else
-                       " Forward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld Backward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld",
+                       " Forward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld Backward: Pkts in %ld Bytes in %ld Pkts out %ld Bytes out %ld";
 #endif
+               sprintf(t, fmt,
                        sl->isl_pkts[0], sl->isl_bytes[0],
                        sl->isl_pkts[1], sl->isl_bytes[1],
                        sl->isl_pkts[2], sl->isl_bytes[2],



Home | Main Index | Thread Index | Old Index