No need to initialize strings with "".
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Thu, 3 Sep 2009 12:34:11 +0000 (14:34 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Thu, 3 Sep 2009 12:34:11 +0000 (14:34 +0200)
Init basic member variables via initializer list.

src/config.cpp
src/httphelper.cpp
src/iphelper.cpp
src/logger.cpp
src/service.cpp
src/serviceholder.cpp

index a255f75..8aaa873 100644 (file)
@@ -34,7 +34,9 @@ using namespace std;
  * Default Constructor. Available command line and config file options with their default values are defined here.
  */
 Config::Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder)
-    : DaemonMode(false)
+    : Log(_log)
+    , ServiceHolder(_serviceholder)
+    , DaemonMode(false)
     , Syslog(false)
     , EnableIPv6(false)
     , Loglevel(0)
@@ -42,12 +44,6 @@ Config::Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder)
     , ExternalWarningLog("")
     , ExternalWarningLevel(0)
 {
-    // initialize Logger
-    Log = _log;
-
-    // initialize Serviceholder
-    ServiceHolder = _serviceholder;
-
     // Available service description config options
     po::options_description opt_desc_service("Service description options");
     opt_desc_service.add_options()
index f402d4c..b1dbbbf 100644 (file)
@@ -33,7 +33,6 @@ HTTPHelper::HTTPHelper(Logger::Ptr _log, const string& _proxy, const int _proxy_
     , ProxyPort(_proxy_port)
 {
     CurlEasyHandle = init_curl(CurlWritedataBuff, CurlErrBuff);
-
     set_curl_auth(_username,_password);
 }
 
index 4fac2d0..446193e 100644 (file)
@@ -19,11 +19,7 @@ namespace net = boost::asio;
  * Default constructor.
  */
 IPHelper::IPHelper()
-    : Hostname("")
-    , WebcheckIpUrl("")
-    , WebcheckIpUrlAlt("")
-    , Proxy("")
-    , ProxyPort(0)
+    : ProxyPort(0)
     , UseIPv6(false)
     , Log(new Logger)
 {
@@ -34,16 +30,14 @@ IPHelper::IPHelper()
  * Constructor.
  */
 IPHelper::IPHelper(const Logger::Ptr _log, const string& _webcheck_url, const string& _webcheck_url_alt, const bool _use_ipv6, const string& _proxy, const int _proxy_port)
-    : Hostname("")
+    : Log(_log)
+    , WebcheckIpUrl(_webcheck_url)
+    , WebcheckIpUrlAl(_webcheck_url_alt)
+    , Proxy(_proxy)
+    , ProxyPort(_proxy_port)
+    , UseIPv6(_use_ipv6)
 {
-    Log = _log;
-    WebcheckIpUrl = _webcheck_url;
-    WebcheckIpUrlAlt = _webcheck_url_alt;
-    Proxy = _proxy;
-    ProxyPort = _proxy_port;
-    UseIPv6 = _use_ipv6;
     Hostname = net::ip::host_name();
-
     Log->print_hostname(Hostname);
 }
 
index 27a0d7b..32f69be 100644 (file)
@@ -25,7 +25,6 @@ using namespace std;
 Logger::Logger()
     : Loglevel(0)
     , Syslog(false)
-    , ExternalWarningLog("")
     , ExternalWarningLevel(0)
 {
     set_log_facility(Loglevel,Syslog,ExternalWarningLog,ExternalWarningLevel);
index 1319aee..a9869e0 100644 (file)
@@ -15,9 +15,7 @@
  * Default Constructor
  */
 Service::Service()
-    : Protocol("")
-    , Hostname("")
-    , Login("NOT SERIALIZED")
+    : Login("NOT SERIALIZED")
     , Password("NOT SERIALIZED")
     , ActualIP("0.0.0.0")
     , UpdateInterval(0)
index 7e33214..e07f84e 100644 (file)
@@ -25,8 +25,8 @@ using namespace std;
  * Default constructor with Logger object.
  */
 Serviceholder::Serviceholder(Logger::Ptr _log)
+    :Log(_log)
 {
-    Log = _log;
 }