Browse Source

[trac3706] More cpp cleanup

Remove another unused variable in memfile_ubench.cc

Actually use the trimmed variable in host.cc

Update commetns in process_spawn.[cc h]
Shawn Routhier 10 years ago
parent
commit
ff0f2e2ad3

+ 2 - 2
src/lib/dhcpsrv/host.cc

@@ -225,8 +225,8 @@ void
 Host::addClientClassInternal(ClientClasses& classes,
                              const std::string& class_name) {
     std::string trimmed = util::str::trim(class_name);
-    if (!class_name.empty()) {
-        classes.insert(ClientClass(class_name));
+    if (!trimmed.empty()) {
+        classes.insert(ClientClass(trimmed));
     }
 }
 

+ 6 - 1
src/lib/util/process_spawn.cc

@@ -31,7 +31,12 @@ namespace util {
 /// custom handling of a SIGCHLD signal, and the conversion of the
 /// arguments of the executable from the STL container to the array.
 ///
-/// Made noncopyable to avoid problems with global operations
+/// This class is made noncopyable so that we don't have attempts
+/// to make multiple copies of an object.  This avoid problems
+/// with multiple copies of objects for a single global resource
+/// such as the SIGCHLD signal handler.  In addition making it
+/// noncopyable keeps the static check codd from flagging the
+/// lack of a copy constructor as an issue.
 class ProcessSpawnImpl : boost::noncopyable {
 public:
 

+ 6 - 1
src/lib/util/process_spawn.h

@@ -54,7 +54,12 @@ typedef std::vector<std::string> ProcessArgs;
 /// attempt to register a new SIGCHLD signal handler and, as a
 /// consequence, the new @c ProcessSpawn object will fail to create.
 ///
-/// Made noncopyable to avoid problems with global operations
+/// This class is made noncopyable so that we don't have attempts
+/// to make multiple copies of an object.  This avoid problems
+/// with multiple copies of objects for a single global resource
+/// such as the SIGCHLD signal handler.  In addition making it
+/// noncopyable keeps the static check codd from flagging the
+/// lack of a copy constructor as an issue.
 ///
 /// @todo The SIGCHLD handling logic should be moved to the @c SignalSet
 /// class so as multiple instances of the @c ProcessSpawn use the same

+ 2 - 2
tests/tools/dhcp-ubench/memfile_ubench.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -215,7 +215,7 @@ void memfile_uBenchmark::createLease4Test() {
     time_t cltt = time(NULL);       // Timestamp
     uint32_t pool_id = 0;           // Let's use pools 0-99
     bool fixed = false;
-    string hostname("foo");         // Will generate it dynamically
+                                    // Hostname will be generated dynamically
     bool fqdn_fwd = true;           // Let's pretend to do AAAA update
     bool fqdn_rev = true;           // Let's pretend to do PTR update