mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
StringView: Rename characters() to characters_without_null_termination().
This should make you think twice before trying to use the const char* from a StringView as if it's a null-terminated string.
This commit is contained in:
@@ -224,7 +224,7 @@ struct CommandTimer {
|
||||
static bool is_glob(const StringView& s)
|
||||
{
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.characters()[i];
|
||||
char c = s.characters_without_null_termination()[i];
|
||||
if (c == '*' || c == '?')
|
||||
return true;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ static Vector<StringView> split_path(const StringView &path)
|
||||
|
||||
ssize_t substart = 0;
|
||||
for (ssize_t i = 0; i < path.length(); i++) {
|
||||
char ch = path.characters()[i];
|
||||
char ch = path.characters_without_null_termination()[i];
|
||||
if (ch != '/')
|
||||
continue;
|
||||
ssize_t sublen = i - substart;
|
||||
|
||||
Reference in New Issue
Block a user