Browse Source

[1324]
Changed PROGNAME to static char *
Build program modules as C files
Removed malloc.h

John DuBois 13 years ago
parent
commit
f9e8151232

+ 1 - 0
tests/tools/perfdhcp/cloptions.cc

@@ -25,6 +25,7 @@ static void initialize(void);
 
 // The current version information
 const char* VERSION = "perfdhcp v1.0 2011-10-30";
+static const char* PROGNAME = "perfdhcp";
 
 static int v6 = 0;                      // DHCPv6 operation (-6)
 static int initialOnly = 0;             // Do only initial exchange (-i)

+ 8 - 0
tests/tools/perfdhcp/cloptions.h

@@ -17,6 +17,10 @@
 #ifndef CLOPTIONS_H
 #define CLOPTIONS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 #include "procconf.h"
 
@@ -46,4 +50,8 @@ const char* getServer(void);    // Server to contact
 const char* getLocalName(void); // Local host/interface (-l)
 const char* getMaxDrop(void);   // Max dropped responses (-D)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

tests/tools/perfdhcp/dkdebug.cc → tests/tools/perfdhcp/dkdebug.c


+ 0 - 2
tests/tools/perfdhcp/perfdhcp.h

@@ -21,8 +21,6 @@
 extern "C" {
 #endif
 
-#define PROGNAME "perfdhcp"
-
 /*
  * The masks associated with keyletters, used in dkdesc structures for setup
  * and passed in the diag_req argument to the output/test functions to

+ 1 - 2
tests/tools/perfdhcp/procconf.cc

@@ -15,7 +15,6 @@
  */
 
 #include <string.h>
-#include <malloc.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -309,7 +308,7 @@ procCmdLineArgs(int* argc, const char** argv[], const confvar_t optConf[],
 
     *p = '\0';
     optind = 1;
-    while ((optchar = getopt(*argc, const_cast<char**>(*argv), optstr)) != -1)
+    while ((optchar = getopt(*argc, *argv, optstr)) != -1)
     {
         int ind;
         int ret;

+ 8 - 0
tests/tools/perfdhcp/procconf.h

@@ -22,6 +22,10 @@
 #ifndef PROCCONF_H
 #define PROCCONF_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <limits.h> /* for UINT_MAX */
 
 /*
@@ -125,4 +129,8 @@ procOpts(int* argc, const char** argv[], const confvar_t optConf[],
  */
 void confdataFree(confdata_t *confdata);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

+ 3 - 3
tests/tools/perfdhcp/tests/Makefile.am

@@ -15,9 +15,9 @@ if HAVE_GTEST
 TESTS += run_unittests
 run_unittests_SOURCES  = run_unittests.cc
 run_unittests_SOURCES += cloptions_unittest.cc
-run_unittests_SOURCES += $(top_builddir)/tests/tools/perfdhcp/cloptions.cc
-run_unittests_SOURCES += $(top_builddir)/tests/tools/perfdhcp/procconf.cc
-run_unittests_SOURCES += $(top_builddir)/tests/tools/perfdhcp/dkdebug.cc
+run_unittests_SOURCES += $(top_builddir)/tests/tools/perfdhcp/cloptions.c
+run_unittests_SOURCES += $(top_builddir)/tests/tools/perfdhcp/procconf.c
+run_unittests_SOURCES += $(top_builddir)/tests/tools/perfdhcp/dkdebug.c
 
 run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 run_unittests_LDFLAGS  = $(AM_LDFLAGS)  $(GTEST_LDFLAGS)