shill: Add missing field initializers and some cleanup.

BUG=none
TEST=unit tests

Change-Id: I96a35a2307affd6bb84f911550bbdaaace81f60d
Reviewed-on: https://gerrit.chromium.org/gerrit/24179
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc
index 2f76207..87cfbda 100644
--- a/cellular_capability_universal.cc
+++ b/cellular_capability_universal.cc
@@ -119,6 +119,8 @@
       weak_ptr_factory_(this),
       registration_state_(MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN),
       cdma_registration_state_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
+      capabilities_(MM_MODEM_CAPABILITY_NONE),
+      current_capabilities_(MM_MODEM_CAPABILITY_NONE),
       access_technologies_(MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN),
       supported_modes_(MM_MODEM_MODE_NONE),
       allowed_modes_(MM_MODEM_MODE_NONE),
diff --git a/dhcp_provider.cc b/dhcp_provider.cc
index e712378..c300df9 100644
--- a/dhcp_provider.cc
+++ b/dhcp_provider.cc
@@ -16,9 +16,9 @@
 
 namespace shill {
 
-// TODO(ers): not using LAZY_INSTANCE_INITIALIZER
-// because of http://crbug.com/114828
-static base::LazyInstance<DHCPProvider> g_dhcp_provider = {0, {{0}} };
+namespace {
+base::LazyInstance<DHCPProvider> g_dhcp_provider = LAZY_INSTANCE_INITIALIZER;
+}  // namespace
 
 DHCPProvider::DHCPProvider()
     : proxy_factory_(ProxyFactory::GetInstance()),
diff --git a/dns_client.cc b/dns_client.cc
index 9e4e510..d961441 100644
--- a/dns_client.cc
+++ b/dns_client.cc
@@ -47,10 +47,12 @@
 
 // Private to the implementation of resolver so callers don't include ares.h
 struct DNSClientState {
+  DNSClientState() : channel(NULL), start_time((struct timeval){0}) {}
+
   ares_channel channel;
   map< ares_socket_t, std::tr1::shared_ptr<IOHandler> > read_handlers;
   map< ares_socket_t, std::tr1::shared_ptr<IOHandler> > write_handlers;
-  struct timeval start_time_;
+  struct timeval start_time;
 };
 
 DNSClient::DNSClient(IPAddress::Family family,
@@ -122,7 +124,7 @@
   }
 
   running_ = true;
-  time_->GetTimeMonotonic(&resolver_state_->start_time_);
+  time_->GetTimeMonotonic(&resolver_state_->start_time);
   ares_->GetHostByName(resolver_state_->channel, hostname.c_str(),
                        address_.family(), ReceiveDNSReplyCB, this);
 
@@ -311,7 +313,7 @@
   // the resolver library.
   struct timeval now, elapsed_time, timeout_tv;
   time_->GetTimeMonotonic(&now);
-  timersub(&now, &resolver_state_->start_time_, &elapsed_time);
+  timersub(&now, &resolver_state_->start_time, &elapsed_time);
   timeout_tv.tv_sec = timeout_ms_ / 1000;
   timeout_tv.tv_usec = (timeout_ms_ % 1000) * 1000;
   timeout_closure_.Cancel();
diff --git a/portal_detector.cc b/portal_detector.cc
index 7faf7c3..f8dff0a 100644
--- a/portal_detector.cc
+++ b/portal_detector.cc
@@ -53,6 +53,7 @@
     EventDispatcher *dispatcher,
     const Callback<void(const Result &)> &callback)
     : attempt_count_(0),
+      attempt_start_time_((struct timeval){0}),
       connection_(connection),
       dispatcher_(dispatcher),
       weak_ptr_factory_(this),
diff --git a/rtnl_message.cc b/rtnl_message.cc
index 6b4c6a0..0404fb4 100644
--- a/rtnl_message.cc
+++ b/rtnl_message.cc
@@ -29,6 +29,8 @@
     : type_(kTypeUnknown),
       mode_(kModeUnknown),
       flags_(0),
+      seq_(0),
+      pid_(0),
       interface_index_(0),
       family_(IPAddress::kFamilyUnknown) {}
 
@@ -348,6 +350,7 @@
   type_ = kTypeUnknown;
   flags_ = 0;
   seq_ = 0;
+  pid_ = 0;
   interface_index_ = 0;
   family_ = IPAddress::kFamilyUnknown;
   link_status_ = LinkStatus();
diff --git a/wifi.cc b/wifi.cc
index 5776a27..8ba9b7a 100644
--- a/wifi.cc
+++ b/wifi.cc
@@ -102,6 +102,7 @@
       supplicant_bss_("(unknown)"),
       clear_cached_credentials_pending_(false),
       need_bss_flush_(false),
+      resumed_at_((struct timeval){0}),
       fast_scans_remaining_(kNumFastScanAttempts),
       bgscan_method_(kDefaultBgscanMethod),
       bgscan_short_interval_seconds_(kDefaultBgscanShortIntervalSeconds),
@@ -109,8 +110,6 @@
       scan_pending_(false),
       scan_interval_seconds_(kDefaultScanIntervalSeconds) {
   PropertyStore *store = this->mutable_store();
-  resumed_at_.tv_sec = 0;
-  resumed_at_.tv_usec = 0;
   HelpRegisterDerivedString(store,
                             flimflam::kBgscanMethodProperty,
                             &WiFi::GetBgscanMethod,