luna: Make OwnedStringView::clone() just call from_string_literal()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3ac3d54788
commit
5aa667c776
@ -28,11 +28,7 @@ OwnedStringView::~OwnedStringView()
|
||||
|
||||
Result<OwnedStringView> OwnedStringView::clone() const
|
||||
{
|
||||
char* const c_str = strdup(m_string);
|
||||
|
||||
if (!c_str) return err(ENOMEM);
|
||||
|
||||
return OwnedStringView { c_str };
|
||||
return from_string_literal(m_string);
|
||||
}
|
||||
|
||||
const char& OwnedStringView::operator[](usize index) const
|
||||
@ -43,7 +39,7 @@ const char& OwnedStringView::operator[](usize index) const
|
||||
|
||||
Result<OwnedStringView> OwnedStringView::from_string_literal(const char* str)
|
||||
{
|
||||
char* dup = strdup(str);
|
||||
char* const dup = strdup(str);
|
||||
if (!dup) return err(ENOMEM);
|
||||
return OwnedStringView { dup };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user