String: Rename from_string_literal to from_cstring

This commit is contained in:
apio 2023-03-29 17:34:30 +02:00
parent ee60ab78b3
commit 01813ff0dd
Signed by: apio
GPG Key ID: B8A7D06E42258954
4 changed files with 6 additions and 6 deletions

View File

@ -451,7 +451,7 @@ namespace MemoryManager
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)

View File

@ -18,7 +18,7 @@ class String
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
{

View File

@ -44,7 +44,7 @@ Result<String> PathParser::basename()
char* result = ::basename(copy);
// 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()
@ -57,5 +57,5 @@ Result<String> PathParser::dirname()
char* result = ::dirname(copy);
// We must copy this as we cannot rely on the original string.
return String::from_string_literal(result);
return String::from_cstring(result);
}

View File

@ -44,7 +44,7 @@ String::~String()
Result<String> String::clone() const
{
return from_string_literal(chars());
return from_cstring(chars());
}
Result<String> String::substring(usize begin, usize size) const
@ -61,7 +61,7 @@ const char& String::operator[](usize index) const
return chars()[index];
}
Result<String> String::from_string_literal(const char* str)
Result<String> String::from_cstring(const char* str)
{
usize len = strlen(str);
if (len < sizeof(m_inline_storage))