From eb9d358be1903525647be6fb25aec4d2d0a8c677 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Thu, 19 Feb 2015 22:30:25 +0100 Subject: [PATCH] Portability fix: remove delegating constructors from SBuf --- src/SBuf.cc | 9 +++++++++ src/SBuf.h | 2 +- src/tests/stub_SBuf.cc | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/SBuf.cc b/src/SBuf.cc index fc784574c5..ead90673c2 100644 --- a/src/SBuf.cc +++ b/src/SBuf.cc @@ -120,6 +120,15 @@ SBuf::SBuf(const char *S, size_type n) ++stats.live; } +SBuf::SBuf(const char *S) + : store_(GetStorePrototype()), off_(0), len_(0) +{ + append(S,npos); + ++stats.alloc; + ++stats.allocFromCString; + ++stats.live; +} + SBuf::~SBuf() { debugs(24, 8, id << " destructed"); diff --git a/src/SBuf.h b/src/SBuf.h index 12d2c75db7..752e9a390d 100644 --- a/src/SBuf.h +++ b/src/SBuf.h @@ -156,7 +156,7 @@ public: * \note bounds is 0 <= pos < length(); caller must pay attention to signedness */ explicit SBuf(const char *S, size_type n); - explicit SBuf(const char *S) : SBuf(S, npos) {} + explicit SBuf(const char *S); /** Constructor: import SquidString, copying contents. * diff --git a/src/tests/stub_SBuf.cc b/src/tests/stub_SBuf.cc index 842164cd7d..f8b41982b4 100644 --- a/src/tests/stub_SBuf.cc +++ b/src/tests/stub_SBuf.cc @@ -26,6 +26,7 @@ SBufStats& SBufStats::operator +=(const SBufStats&) STUB_RETVAL(*this) SBuf::SBuf() {} SBuf::SBuf(const SBuf &S) {} SBuf::SBuf(const char *S, size_type n) {} +SBuf::SBuf(const char *S) {} SBuf::SBuf(const String &S) {} SBuf::SBuf(const std::string &s) {} SBuf::~SBuf() {} -- 2.47.2