From 9461bc948f8fb9912a913e54b5dd401f1729ed2c Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 14 Aug 2019 15:28:10 -0700 Subject: [PATCH] . --- node/Buffer.hpp | 1 + node/RingBuffer.hpp | 2 +- node/SelfAwareness.cpp | 2 +- node/SelfAwareness.hpp | 10 ++++++---- node/SharedPtr.hpp | 8 ++++---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/node/Buffer.hpp b/node/Buffer.hpp index 78008f451..1a6ab8c6c 100644 --- a/node/Buffer.hpp +++ b/node/Buffer.hpp @@ -78,6 +78,7 @@ public: typedef int difference_type; typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; + inline iterator begin() { return _b; } inline iterator end() { return (_b + _l); } inline const_iterator begin() const { return _b; } diff --git a/node/RingBuffer.hpp b/node/RingBuffer.hpp index 0f29a89a9..8180b4001 100644 --- a/node/RingBuffer.hpp +++ b/node/RingBuffer.hpp @@ -57,7 +57,7 @@ private: bool wrap; public: - RingBuffer() : + inline RingBuffer() : begin(0), end(0), wrap(false) diff --git a/node/SelfAwareness.cpp b/node/SelfAwareness.cpp index 0fb9e4a43..5b3aeba91 100644 --- a/node/SelfAwareness.cpp +++ b/node/SelfAwareness.cpp @@ -49,7 +49,7 @@ namespace ZeroTier { class _ResetWithinScope { public: - _ResetWithinScope(void *tPtr,int64_t now,int inetAddressFamily,InetAddress::IpScope scope) : + inline _ResetWithinScope(void *tPtr,int64_t now,int inetAddressFamily,InetAddress::IpScope scope) : _now(now), _tPtr(tPtr), _family(inetAddressFamily), diff --git a/node/SelfAwareness.hpp b/node/SelfAwareness.hpp index 7940f5ac0..b09243dd8 100644 --- a/node/SelfAwareness.hpp +++ b/node/SelfAwareness.hpp @@ -72,11 +72,13 @@ private: InetAddress reporterPhysicalAddress; InetAddress::IpScope scope; - PhySurfaceKey() : reporter(),scope(InetAddress::IP_SCOPE_NONE) {} - PhySurfaceKey(const Address &r,const int64_t rol,const InetAddress &ra,InetAddress::IpScope s) : reporter(r),receivedOnLocalSocket(rol),reporterPhysicalAddress(ra),scope(s) {} + inline PhySurfaceKey() : reporter(),scope(InetAddress::IP_SCOPE_NONE) {} + inline PhySurfaceKey(const Address &r,const int64_t rol,const InetAddress &ra,InetAddress::IpScope s) : reporter(r),receivedOnLocalSocket(rol),reporterPhysicalAddress(ra),scope(s) {} inline unsigned long hashCode() const { return ((unsigned long)reporter.toInt() + (unsigned long)scope); } + inline bool operator==(const PhySurfaceKey &k) const { return ((reporter == k.reporter)&&(receivedOnLocalSocket == k.receivedOnLocalSocket)&&(reporterPhysicalAddress == k.reporterPhysicalAddress)&&(scope == k.scope)); } + inline bool operator!=(const PhySurfaceKey &k) const { return (!(*this == k)); } }; struct PhySurfaceEntry { @@ -84,8 +86,8 @@ private: uint64_t ts; bool trusted; - PhySurfaceEntry() : mySurface(),ts(0),trusted(false) {} - PhySurfaceEntry(const InetAddress &a,const uint64_t t) : mySurface(a),ts(t),trusted(false) {} + inline PhySurfaceEntry() : mySurface(),ts(0),trusted(false) {} + inline PhySurfaceEntry(const InetAddress &a,const uint64_t t) : mySurface(a),ts(t),trusted(false) {} }; const RuntimeEnvironment *RR; diff --git a/node/SharedPtr.hpp b/node/SharedPtr.hpp index c7f9ea97e..87c6411e9 100644 --- a/node/SharedPtr.hpp +++ b/node/SharedPtr.hpp @@ -43,11 +43,11 @@ template class SharedPtr { public: - SharedPtr() : _ptr((T *)0) {} - SharedPtr(T *obj) : _ptr(obj) { ++obj->__refCount; } - SharedPtr(const SharedPtr &sp) : _ptr(sp._getAndInc()) {} + inline SharedPtr() : _ptr((T *)0) {} + inline SharedPtr(T *obj) : _ptr(obj) { ++obj->__refCount; } + inline SharedPtr(const SharedPtr &sp) : _ptr(sp._getAndInc()) {} - ~SharedPtr() + inline ~SharedPtr() { if (_ptr) { if (--_ptr->__refCount <= 0)