[ox] Cleanup
All checks were successful
Build / build (push) Successful in 1m10s

This commit is contained in:
2026-01-25 22:05:49 -06:00
parent 07688a2c29
commit 0e028ff653
4 changed files with 12 additions and 5 deletions

View File

@@ -135,7 +135,7 @@ class ModelHandlerInterface {
return m_handler->field(name, &v->template get<ModelValueArray>());
}
oxErrf("invalid type: {}: {}\n", name, static_cast<int>(v->type()));
ox::panic(ox::Error(1), "invalid type");
ox::panic("invalid type");
return ox::Error(1, "invalid type");
}

View File

@@ -168,7 +168,7 @@ class ModelValue {
constexpr const auto &get() const noexcept {
constexpr auto type = getType<T>();
if (m_type != type) [[unlikely]] {
ox::panic(ox::Error(1), "invalid cast");
ox::panic("invalid cast");
}
return getValue<type>(*this);
}
@@ -178,7 +178,7 @@ class ModelValue {
constexpr auto &get() noexcept {
constexpr auto type = getType<T>();
if (m_type != type) [[unlikely]] {
ox::panic(ox::Error(1), "invalid cast");
ox::panic("invalid cast");
}
return getValue<type>(*this);
}

View File

@@ -28,6 +28,13 @@ void panic(
StringViewCR panicMsg,
std::source_location const &src = std::source_location::current()) noexcept;
[[noreturn]]
inline void panic(
StringViewCR panicMsg,
std::source_location const &src = std::source_location::current()) noexcept {
panic(Error{1}, panicMsg, src);
}
[[noreturn]]
constexpr void constexprPanic(
StringViewCR panicMsg,

View File

@@ -77,7 +77,7 @@ static HeapSegment *findSegmentFor(std::size_t sz) noexcept {
return s;
}
}
ox::panic(ox::Error(1), "malloc: could not find segment");
ox::panic("malloc: could not find segment");
return nullptr;
}
@@ -102,7 +102,7 @@ void free(void *ptr) noexcept {
} else if (p.segment) {
p.segment->inUse = false;
} else {
ox::panic(ox::Error(1), "Bad heap free");
ox::panic("Bad heap free");
}
}