]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Remove inttoa() and uinttoa(), convert solitary use of latter
authorDave Hart <hart@ntp.org>
Wed, 18 Apr 2012 05:03:10 +0000 (05:03 +0000)
committerDave Hart <hart@ntp.org>
Wed, 18 Apr 2012 05:03:10 +0000 (05:03 +0000)
  to simpler code.

bk: 4f8e4b0eM-Ud6xQn229JAhqlBZ7JaQ

include/ntp_stdlib.h
libntp/Makefile.am
libntp/inttoa.c [deleted file]
libntp/uinttoa.c [deleted file]
ntpq/ntpq-subs.c
ports/winnt/vs2005/libntp.vcproj
ports/winnt/vs2008/libntp/libntp.vcproj
tests/libntp/Makefile.am
tests/libntp/inttoa.cpp [deleted file]
tests/libntp/uinttoa.cpp [deleted file]

index 4f31c9d3a63ae875c52d54e9c6086fc554962e01..9c4215cb37ae186f292b06cc7a27b039dece5f2c 100644 (file)
@@ -153,7 +153,6 @@ extern      int     atouint         (const char *, u_long *);
 extern int     hextoint        (const char *, u_long *);
 extern char *  humanlogtime    (void);
 extern char *  humantime       (time_t);
-extern char *  inttoa          (long);
 extern char *  mfptoa          (u_int32, u_int32, short);
 extern char *  mfptoms         (u_int32, u_int32, short);
 extern const char * modetoa    (int);
@@ -177,7 +176,6 @@ extern      int     octtoint        (const char *, u_long *);
 extern u_long  ranp2           (int);
 extern const char *refnumtoa   (sockaddr_u *);
 extern const char *refid_str   (u_int32, int);
-extern char *  uinttoa         (u_long);
 
 extern int     decodenetnum    (const char *, sockaddr_u *);
 
index 970f48ae7e58fb8d8d6e8e57b22e56e62b78e92c..9a25fd23a455b0409a59d1d2251fab9c249b4438 100644 (file)
@@ -66,7 +66,6 @@ libntp_a_SRCS =                                               \
        hextolfp.c                                      \
        humandate.c                                     \
        icom.c                                          \
-       inttoa.c                                        \
        iosignal.c                                      \
        lib_strbuf.c                                    \
        machines.c                                      \
@@ -100,7 +99,6 @@ libntp_a_SRCS =                                              \
        timetoa.c                                       \
        timevalops.c                                    \
        uglydate.c                                      \
-       uinttoa.c                                       \
        work_fork.c                                     \
        work_thread.c                                   \
        ymd2yd.c                                        \
diff --git a/libntp/inttoa.c b/libntp/inttoa.c
deleted file mode 100644 (file)
index f34710e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * inttoa - return an asciized signed integer
- */
-#include <config.h>
-#include <stdio.h>
-
-#include "lib_strbuf.h"
-#include "ntp_stdlib.h"
-
-char *
-inttoa(
-       long val
-       )
-{
-       register char *buf;
-
-       LIB_GETBUF(buf);
-       snprintf(buf, LIB_BUFLENGTH, "%ld", val);
-
-       return buf;
-}
diff --git a/libntp/uinttoa.c b/libntp/uinttoa.c
deleted file mode 100644 (file)
index f1925f4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * uinttoa - return an asciized unsigned integer
- */
-#include <config.h>
-#include <stdio.h>
-
-#include "lib_strbuf.h"
-#include "ntp_stdlib.h"
-
-char *
-uinttoa(
-       u_long uval
-       )
-{
-       register char *buf;
-
-       LIB_GETBUF(buf);
-       snprintf(buf, LIB_BUFLENGTH, "%lu", uval);
-
-       return buf;
-}
index d11d5db666931801182c0bf10eb1af462868a1b8..2297d313254ddded8e7cd85cf77ea749eb118fe2 100644 (file)
@@ -1126,7 +1126,6 @@ printassoc(
        const char *auth;
        const char *condition = "";
        const char *last_event;
-       const char *cnt;
        char buf[128];
 
        if (numassoc == 0) {
@@ -1281,12 +1280,11 @@ printassoc(
                        last_event = "";
                        break;
                }
-               cnt = uinttoa(event_count);
                snprintf(buf, sizeof(buf),
-                        "%3d %5u  %04x   %3.3s  %4s  %4.4s %9.9s %11s %2s",
+                        "%3d %5u  %04x   %3.3s  %4s  %4.4s %9.9s %11s %2lu",
                         i + 1, assoc_cache[i].assid,
                         assoc_cache[i].status, conf, reach, auth,
-                        condition, last_event, cnt);
+                        condition, last_event, event_count);
                bp = buf + strlen(buf);
                while (bp > buf && ' ' == bp[-1])
                        --bp;
index c998cc842fda36d2e3f9eee6dadd64220c889664..26d51d2f8f0c2ab488ae26122b4a4d13f848850a 100644 (file)
                                RelativePath="..\..\..\lib\isc\win32\interfaceiter.c"
                                >
                        </File>
-                       <File
-                               RelativePath="..\..\..\libntp\inttoa.c"
-                               >
-                       </File>
                        <File
                                RelativePath="..\..\..\libntp\iosignal.c"
                                >
                                RelativePath="..\..\..\libntp\uglydate.c"
                                >
                        </File>
-                       <File
-                               RelativePath="..\..\..\libntp\uinttoa.c"
-                               >
-                       </File>
                        <File
                                RelativePath="..\libntp\util_clockstuff.c"
                                >
index 74c1969b95caa713cb232847c3683b934431e920..37e301bed42865f0a11fbfd785df914acdb18467 100644 (file)
                                RelativePath="..\..\..\..\lib\isc\win32\interfaceiter.c"
                                >
                        </File>
-                       <File
-                               RelativePath="..\..\..\..\libntp\inttoa.c"
-                               >
-                       </File>
                        <File
                                RelativePath="..\..\..\..\libntp\iosignal.c"
                                >
                                RelativePath="..\..\..\..\libntp\uglydate.c"
                                >
                        </File>
-                       <File
-                               RelativePath="..\..\..\..\libntp\uinttoa.c"
-                               >
-                       </File>
                        <File
                                RelativePath="..\..\libntp\util_clockstuff.c"
                                >
                                >
                        </File>
                        <File
-                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
+                               RelativePath="..\..\include\sys\time.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\include\sys\time.h"
+                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
                                >
                        </File>
                        <File
index de6067595e82de9425eade6002cb8fe147bef5f7..532fa2dcdc44bbbeab56e37f3cc726f5fff2cd81 100644 (file)
@@ -39,7 +39,6 @@ tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp     \
                hextoint.cpp            \
                hextolfp.cpp            \
                humandate.cpp           \
-               inttoa.cpp              \
                lfptostr.cpp            \
                modetoa.cpp             \
                msyslog.cpp             \
@@ -61,7 +60,6 @@ tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp     \
                tstotv.cpp              \
                tvtots.cpp              \
                uglydate.cpp            \
-               uinttoa.cpp             \
                ymd2yd.cpp              \
                $(NULL)
 
diff --git a/tests/libntp/inttoa.cpp b/tests/libntp/inttoa.cpp
deleted file mode 100644 (file)
index 2c8b85b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "libntptest.h"
-
-class inttoaTest : public libntptest {
-};
-
-TEST_F(inttoaTest, RegularNumber) {
-       EXPECT_STREQ("42", inttoa(42));
-}
-
-TEST_F(inttoaTest, NegativeNumber) {
-       EXPECT_STREQ("-3", inttoa(-3));
-}
-
-/* Bug 1575 start */
-TEST_F(inttoaTest, BigPositiveNumber) {
-       EXPECT_STREQ("2147483647", inttoa(2147483647L));
-}
-
-TEST_F(inttoaTest, BigNegativeNumber) {
-       EXPECT_STREQ("-2147483648", inttoa(-2147483647L - 1L));
-}
-
-TEST_F(inttoaTest, MediumNumber) {
-       EXPECT_STREQ("20000001", inttoa(20000001));
-}
-/* Bug 1575 end */
diff --git a/tests/libntp/uinttoa.cpp b/tests/libntp/uinttoa.cpp
deleted file mode 100644 (file)
index fac4480..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "libntptest.h"
-
-class uinttoaTest : public libntptest {
-};
-
-TEST_F(uinttoaTest, RegularNumber) {
-       EXPECT_STREQ("39", uinttoa(39UL));
-}
-
-TEST_F(uinttoaTest, BiggestULong) {
-       EXPECT_STREQ("4294967295", uinttoa(4294967295UL));
-}