String: Rename from_string_literal to from_cstring
This commit is contained in:
parent
ee60ab78b3
commit
01813ff0dd
@ -451,7 +451,7 @@ namespace MemoryManager
|
|||||||
|
|
||||||
TRY(result.try_append(0)); // null terminator
|
TRY(result.try_append(0)); // null terminator
|
||||||
|
|
||||||
return String::from_string_literal(result.data());
|
return String::from_cstring(result.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validate_user_write(void* user, usize size)
|
bool validate_user_write(void* user, usize size)
|
||||||
|
@ -18,7 +18,7 @@ class String
|
|||||||
|
|
||||||
Result<String> substring(usize begin, usize size) const;
|
Result<String> substring(usize begin, usize size) const;
|
||||||
|
|
||||||
static Result<String> from_string_literal(const char* str);
|
static Result<String> from_cstring(const char* str);
|
||||||
|
|
||||||
const char* chars() const
|
const char* chars() const
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ Result<String> PathParser::basename()
|
|||||||
char* result = ::basename(copy);
|
char* result = ::basename(copy);
|
||||||
|
|
||||||
// We must copy this as we cannot rely on the original string.
|
// We must copy this as we cannot rely on the original string.
|
||||||
return String::from_string_literal(result);
|
return String::from_cstring(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<String> PathParser::dirname()
|
Result<String> PathParser::dirname()
|
||||||
@ -57,5 +57,5 @@ Result<String> PathParser::dirname()
|
|||||||
char* result = ::dirname(copy);
|
char* result = ::dirname(copy);
|
||||||
|
|
||||||
// We must copy this as we cannot rely on the original string.
|
// We must copy this as we cannot rely on the original string.
|
||||||
return String::from_string_literal(result);
|
return String::from_cstring(result);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ String::~String()
|
|||||||
|
|
||||||
Result<String> String::clone() const
|
Result<String> String::clone() const
|
||||||
{
|
{
|
||||||
return from_string_literal(chars());
|
return from_cstring(chars());
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<String> String::substring(usize begin, usize size) const
|
Result<String> String::substring(usize begin, usize size) const
|
||||||
@ -61,7 +61,7 @@ const char& String::operator[](usize index) const
|
|||||||
return chars()[index];
|
return chars()[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<String> String::from_string_literal(const char* str)
|
Result<String> String::from_cstring(const char* str)
|
||||||
{
|
{
|
||||||
usize len = strlen(str);
|
usize len = strlen(str);
|
||||||
if (len < sizeof(m_inline_storage))
|
if (len < sizeof(m_inline_storage))
|
||||||
|
Loading…
Reference in New Issue
Block a user