Compare commits
2 Commits
59765aa334
...
b316e3b3b7
Author | SHA1 | Date | |
---|---|---|---|
b316e3b3b7 | |||
da39ba33a9 |
@ -118,10 +118,12 @@ static bool g_check_already_failed = false;
|
|||||||
|
|
||||||
[[noreturn]] bool __check_failed(const char* file, const char* line, const char* func, const char* expr)
|
[[noreturn]] bool __check_failed(const char* file, const char* line, const char* func, const char* expr)
|
||||||
{
|
{
|
||||||
|
CPU::disable_interrupts();
|
||||||
if (!g_check_already_failed)
|
if (!g_check_already_failed)
|
||||||
{ // Avoid endlessly failing when trying to report a failed check.
|
{ // Avoid endlessly failing when trying to report a failed check.
|
||||||
g_check_already_failed = true;
|
g_check_already_failed = true;
|
||||||
kerrorln("ERROR: Check failed at %s:%s, in %s: %s", file, line, func, expr);
|
kerrorln("ERROR: Check failed at %s:%s, in %s: %s", file, line, func, expr);
|
||||||
|
CPU::print_stack_trace();
|
||||||
}
|
}
|
||||||
CPU::efficient_halt();
|
CPU::efficient_halt();
|
||||||
}
|
}
|
@ -22,11 +22,7 @@ class OwnedStringView
|
|||||||
return m_length;
|
return m_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char& operator[](usize index) const
|
const char& operator[](usize) const;
|
||||||
{
|
|
||||||
expect(index < m_length, "OwnedStringView: index out of range");
|
|
||||||
return m_string[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char* m_string{nullptr};
|
char* m_string{nullptr};
|
||||||
|
@ -33,4 +33,10 @@ Result<OwnedStringView> OwnedStringView::clone() const
|
|||||||
if (!c_str) return err(ENOMEM);
|
if (!c_str) return err(ENOMEM);
|
||||||
|
|
||||||
return OwnedStringView{c_str};
|
return OwnedStringView{c_str};
|
||||||
|
}
|
||||||
|
|
||||||
|
const char& OwnedStringView::operator[](usize index) const
|
||||||
|
{
|
||||||
|
expect(index < m_length, "index out of range");
|
||||||
|
return m_string[index];
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user