summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-07-27 11:44:39 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-07-31 17:27:02 +0200
commit157ff8c0b62477efeea1947b80ad62c54a51decc (patch)
treef825f2990bdaf18983f58ca0560c6e73fcf99a1b /vespalib
parent61857dbdbffcdc116ab9a365a95e1da131fe7a89 (diff)
Use noexcept to get move constructor usage on containers and use fastCompare.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.h8
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.hpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/vespalib/src/vespa/vespalib/stllike/string.h b/vespalib/src/vespa/vespalib/stllike/string.h
index 8b7ff2dad12..3db36f5fd41 100644
--- a/vespalib/src/vespa/vespalib/stllike/string.h
+++ b/vespalib/src/vespa/vespalib/stllike/string.h
@@ -180,8 +180,8 @@ public:
small_string(const void * s, size_type sz) : _buf(_stack), _sz(sz) { init(s); }
small_string(const stringref & s) : _buf(_stack), _sz(s.size()) { init(s.c_str()); }
small_string(const std::string & s) : _buf(_stack), _sz(s.size()) { init(s.c_str()); }
- small_string(const small_string & rhs) : _buf(_stack), _sz(rhs.size()) { init(rhs.c_str()); }
- small_string(const small_string & rhs, size_type pos, size_type sz=npos)
+ small_string(const small_string & rhs) noexcept : _buf(_stack), _sz(rhs.size()) { init(rhs.c_str()); }
+ small_string(const small_string & rhs, size_type pos, size_type sz=npos) noexcept
: _buf(_stack), _sz(std::min(sz, rhs.size()-pos))
{
init(rhs.c_str()+pos);
@@ -520,7 +520,7 @@ public:
}
private:
void assign_slower(const void * s, size_type sz) __attribute((noinline));
- void init_slower(const void *s) __attribute((noinline));
+ void init_slower(const void *s) noexcept __attribute((noinline));
void _reserveBytes(size_type newBufferSize);
void reserveBytes(size_type newBufferSize) {
if (newBufferSize > _bufferSize) {
@@ -533,7 +533,7 @@ private:
char * buffer() { return _buf; }
const char * buffer() const { return _buf; }
void appendAlloc(const void * s, size_type sz) __attribute__((noinline));
- void init(const void *s) {
+ void init(const void *s) noexcept {
if (__builtin_expect(_sz < StackSize, true)) {
_bufferSize = StackSize;
memcpy(_stack, s, _sz);
diff --git a/vespalib/src/vespa/vespalib/stllike/string.hpp b/vespalib/src/vespa/vespalib/stllike/string.hpp
index d6512cddc15..3ead42ee41e 100644
--- a/vespalib/src/vespa/vespalib/stllike/string.hpp
+++ b/vespalib/src/vespa/vespalib/stllike/string.hpp
@@ -91,7 +91,7 @@ void small_string<StackSize>::assign_slower(const void * s, size_type sz)
}
template <uint32_t StackSize>
-void small_string<StackSize>::init_slower(const void *s)
+void small_string<StackSize>::init_slower(const void *s) noexcept
{
_bufferSize = _sz+1;
_buf = (char *) malloc(_bufferSize);