From 98e4ddfb21d285c8b675788c155bb204822fbd4a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 6 Feb 2020 11:25:42 +0000 Subject: Use C++11 inline initialisation for class members. --- include/socketengine.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'include/socketengine.h') diff --git a/include/socketengine.h b/include/socketengine.h index e54dfca97..0d0108038 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -232,20 +232,15 @@ class CoreExport SocketEngine */ class Statistics { - mutable size_t indata; - mutable size_t outdata; - mutable time_t lastempty; + mutable size_t indata = 0; + mutable size_t outdata = 0; + mutable time_t lastempty = 0; /** Reset the byte counters and lastempty if there wasn't a reset in this second. */ void CheckFlush() const; public: - /** Constructor, initializes member vars except indata and outdata because those are set to 0 - * in CheckFlush() the first time Update() or GetBandwidth() is called. - */ - Statistics() : lastempty(0), TotalEvents(0), ReadEvents(0), WriteEvents(0), ErrorEvents(0) { } - /** Update counters for network data received. * This should be called after every read-type syscall. * @param len_in Number of bytes received, or -1 for error, as typically @@ -267,10 +262,10 @@ class CoreExport SocketEngine */ void CoreExport GetBandwidth(float& kbitpersec_in, float& kbitpersec_out, float& kbitpersec_total) const; - unsigned long TotalEvents; - unsigned long ReadEvents; - unsigned long WriteEvents; - unsigned long ErrorEvents; + unsigned long TotalEvents = 0; + unsigned long ReadEvents = 0; + unsigned long WriteEvents = 0; + unsigned long ErrorEvents = 0; }; private: -- cgit v1.3.1-10-gc9f91