all: assorted cleanups

This commit is contained in:
Markus F.X.J. Oberhumer
2024-01-24 20:53:14 +01:00
parent 65b25adceb
commit 5d649f83ec
27 changed files with 535 additions and 367 deletions
+7 -4
View File
@@ -37,8 +37,10 @@ Throwable::Throwable(const char *m, int e, bool w) noexcept : super(),
msg(nullptr),
err(e),
is_warning(w) {
if (m)
if (m != nullptr) {
msg = strdup(m);
assert_noexcept(msg != nullptr);
}
#if 0
fprintf(stderr, "construct exception: %s %zu\n", msg, debug_counter);
debug_counter += 1;
@@ -49,8 +51,10 @@ Throwable::Throwable(const Throwable &other) noexcept : super(other),
msg(nullptr),
err(other.err),
is_warning(other.is_warning) {
if (other.msg)
if (other.msg != nullptr) {
msg = strdup(other.msg);
assert_noexcept(msg != nullptr);
}
#if 0
fprintf(stderr, "copy exception: %s %zu\n", msg, debug_counter);
debug_counter += 1;
@@ -62,8 +66,7 @@ Throwable::~Throwable() noexcept {
debug_counter -= 1;
fprintf(stderr, "destruct exception: %s %zu\n", msg, debug_counter);
#endif
if (msg)
free(msg);
upx::owner_free(msg);
}
/*************************************************************************