TmpFS: Use StaticString<128> instead of char[128]

This commit is contained in:
apio 2023-02-27 15:14:07 +01:00
parent 5a9d31c2be
commit 65dd3cd7fb
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 4 additions and 6 deletions

View File

@ -45,7 +45,7 @@ namespace TmpFS
{
for (const auto& entry : m_entries)
{
if (!strcmp(name, entry.name)) return entry.inode;
if (!strcmp(name, entry.name.chars())) return entry.inode;
}
return err(ENOENT);
@ -53,9 +53,7 @@ namespace TmpFS
Result<void> DirInode::add_entry(SharedPtr<VFS::Inode> inode, const char* name)
{
Entry entry;
entry.inode = inode;
strlcpy(entry.name, name, sizeof(entry.name));
Entry entry { inode, name };
TRY(m_entries.try_append(move(entry)));

View File

@ -2,7 +2,7 @@
#include "fs/VFS.h"
#include <luna/Atomic.h>
#include <luna/Badge.h>
#include <luna/OwnedStringView.h>
#include <luna/StaticString.h>
#include <luna/Vector.h>
namespace TmpFS
@ -110,7 +110,7 @@ namespace TmpFS
struct Entry
{
SharedPtr<VFS::Inode> inode;
char name[128];
StaticString<128> name;
};
Vector<Entry> m_entries;