summaryrefslogtreecommitdiffstats
path: root/vespalog/src/vespa/log/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'vespalog/src/vespa/log/internal.h')
-rw-r--r--vespalog/src/vespa/log/internal.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/vespalog/src/vespa/log/internal.h b/vespalog/src/vespa/log/internal.h
index c9081b72ce9..4411d9fa6e6 100644
--- a/vespalog/src/vespa/log/internal.h
+++ b/vespalog/src/vespa/log/internal.h
@@ -1,7 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <cstring>
+#include <string>
#include <cstdlib>
#if !__GNUC__ && !defined(__attribute__)
@@ -15,15 +15,14 @@ void throwInvalid(const char *fmt, ...)
class InvalidLogException {
private:
- char *_what;
- InvalidLogException& operator = (const InvalidLogException&);
+ std::string _what;
public:
- InvalidLogException(const InvalidLogException &x) :
- _what(strdup(x._what)) {}
- InvalidLogException(const char *s) : _what(strdup(s)) {}
- ~InvalidLogException() { free(_what); }
- const char *what() const { return _what; }
+ InvalidLogException& operator = (const InvalidLogException&) = delete;
+ InvalidLogException(const InvalidLogException &x) = default;
+ InvalidLogException(const char *s) : _what(s) {}
+ ~InvalidLogException() = default;
+ const char *what() const { return _what.c_str(); }
};
} // end namespace ns_log