1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

Yet another pass of style fixes.

This commit is contained in:
Andreas Kling 2018-12-21 02:10:45 +01:00
parent 89040cdc99
commit ec1c487dcd
43 changed files with 183 additions and 185 deletions

View file

@ -16,7 +16,7 @@ ssize_t DoubleBuffer::write(const byte* data, size_t size)
ssize_t DoubleBuffer::read(byte* data, size_t size)
{
if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->isEmpty())
if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->is_empty())
flip();
if (m_read_buffer_index >= m_read_buffer->size())
return 0;

View file

@ -14,7 +14,7 @@ public:
ssize_t write(const byte*, size_t);
ssize_t read(byte*, size_t);
bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->isEmpty(); }
bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->is_empty(); }
private:
void flip();

View file

@ -132,8 +132,8 @@ void IDEDiskDevice::initialize()
enable_irq();
wait_for_irq();
ByteBuffer wbuf = ByteBuffer::createUninitialized(512);
ByteBuffer bbuf = ByteBuffer::createUninitialized(512);
ByteBuffer wbuf = ByteBuffer::create_uninitialized(512);
ByteBuffer bbuf = ByteBuffer::create_uninitialized(512);
byte* b = bbuf.pointer();
word* w = (word*)wbuf.pointer();
const word* wbufbase = (word*)wbuf.pointer();

View file

@ -32,7 +32,7 @@ ByteBuffer procfs$pid_fds(Process& process)
{
ProcessInspectionHandle handle(process);
char* buffer;
auto stringImpl = StringImpl::createUninitialized(process.number_of_open_file_descriptors() * 80, buffer);
auto stringImpl = StringImpl::create_uninitialized(process.number_of_open_file_descriptors() * 80, buffer);
memset(buffer, 0, stringImpl->length());
char* ptr = buffer;
for (size_t i = 0; i < process.max_open_file_descriptors(); ++i) {
@ -49,7 +49,7 @@ ByteBuffer procfs$pid_vm(Process& process)
{
ProcessInspectionHandle handle(process);
char* buffer;
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 160 + 4096, buffer);
auto stringImpl = StringImpl::create_uninitialized(80 + process.regionCount() * 160 + 4096, buffer);
memset(buffer, 0, stringImpl->length());
char* ptr = buffer;
ptr += ksprintf(ptr, "BEGIN END SIZE COMMIT NAME\n");
@ -69,7 +69,7 @@ ByteBuffer procfs$pid_vmo(Process& process)
{
ProcessInspectionHandle handle(process);
char* buffer;
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 160 + 4096, buffer);
auto stringImpl = StringImpl::create_uninitialized(80 + process.regionCount() * 160 + 4096, buffer);
memset(buffer, 0, stringImpl->length());
char* ptr = buffer;
ptr += ksprintf(ptr, "BEGIN END SIZE NAME\n");
@ -118,7 +118,7 @@ ByteBuffer procfs$pid_stack(Process& process)
for (auto& symbol : recognizedSymbols) {
bytesNeeded += symbol.ksym->name.length() + 8 + 16;
}
auto buffer = ByteBuffer::createUninitialized(bytesNeeded);
auto buffer = ByteBuffer::create_uninitialized(bytesNeeded);
char* bufptr = (char*)buffer.pointer();
for (auto& symbol : recognizedSymbols) {
@ -134,7 +134,7 @@ ByteBuffer procfs$pid_regs(Process& process)
{
ProcessInspectionHandle handle(process);
auto& tss = process.tss();
auto buffer = ByteBuffer::createUninitialized(1024);
auto buffer = ByteBuffer::create_uninitialized(1024);
char* ptr = (char*)buffer.pointer();
ptr += ksprintf(ptr, "eax: %x\n", tss.eax);
ptr += ksprintf(ptr, "ebx: %x\n", tss.ebx);
@ -156,7 +156,7 @@ ByteBuffer procfs$pid_exe(Process& process)
ProcessInspectionHandle handle(process);
auto inode = process.executable_inode();
ASSERT(inode);
return VFS::the().absolute_path(*inode).toByteBuffer();
return VFS::the().absolute_path(*inode).to_byte_buffer();
}
ByteBuffer procfs$pid_cwd(Process& process)
@ -164,7 +164,7 @@ ByteBuffer procfs$pid_cwd(Process& process)
ProcessInspectionHandle handle(process);
auto inode = process.cwd_inode();
ASSERT(inode);
return VFS::the().absolute_path(*inode).toByteBuffer();
return VFS::the().absolute_path(*inode).to_byte_buffer();
}
void ProcFS::add_process(Process& process)
@ -199,7 +199,7 @@ ByteBuffer procfs$mm()
{
// FIXME: Implement
InterruptDisabler disabler;
auto buffer = ByteBuffer::createUninitialized(1024 + 80 * MM.m_vmos.size());
auto buffer = ByteBuffer::create_uninitialized(1024 + 80 * MM.m_vmos.size());
char* ptr = (char*)buffer.pointer();
for (auto* vmo : MM.m_vmos) {
ptr += ksprintf(ptr, "VMO: %p %s(%u): p:%4u %s\n",
@ -219,7 +219,7 @@ ByteBuffer procfs$regions()
{
// FIXME: Implement
InterruptDisabler disabler;
auto buffer = ByteBuffer::createUninitialized(1024 + 80 * MM.m_regions.size());
auto buffer = ByteBuffer::create_uninitialized(1024 + 80 * MM.m_regions.size());
char* ptr = (char*)buffer.pointer();
for (auto* region : MM.m_regions) {
ptr += ksprintf(ptr, "Region: %p VMO=%p %s\n",
@ -235,7 +235,7 @@ ByteBuffer procfs$regions()
ByteBuffer procfs$mounts()
{
InterruptDisabler disabler;
auto buffer = ByteBuffer::createUninitialized(VFS::the().mount_count() * 80);
auto buffer = ByteBuffer::create_uninitialized(VFS::the().mount_count() * 80);
char* ptr = (char*)buffer.pointer();
VFS::the().for_each_mount([&ptr] (auto& mount) {
auto& fs = mount.guest_fs();
@ -251,7 +251,7 @@ ByteBuffer procfs$mounts()
ByteBuffer procfs$cpuinfo()
{
auto buffer = ByteBuffer::createUninitialized(256);
auto buffer = ByteBuffer::create_uninitialized(256);
char* ptr = (char*)buffer.pointer();
{
CPUID cpuid(0);
@ -316,7 +316,7 @@ ByteBuffer procfs$cpuinfo()
ByteBuffer procfs$kmalloc()
{
auto buffer = ByteBuffer::createUninitialized(256);
auto buffer = ByteBuffer::create_uninitialized(256);
char* ptr = (char*)buffer.pointer();
ptr += ksprintf(ptr, "eternal: %u\npage-aligned: %u\nallocated: %u\nfree: %u\n", kmalloc_sum_eternal, sum_alloc, sum_free);
buffer.trim(ptr - (char*)buffer.pointer());
@ -327,7 +327,7 @@ ByteBuffer procfs$summary()
{
InterruptDisabler disabler;
auto processes = Process::allProcesses();
auto buffer = ByteBuffer::createUninitialized(processes.size() * 256);
auto buffer = ByteBuffer::create_uninitialized(processes.size() * 256);
char* ptr = (char*)buffer.pointer();
ptr += ksprintf(ptr, "PID TPG PGP SID OWNER STATE PPID NSCHED FDS TTY NAME\n");
for (auto* process : processes) {
@ -352,7 +352,7 @@ ByteBuffer procfs$summary()
ByteBuffer procfs$vnodes()
{
auto& vfs = VFS::the();
auto buffer = ByteBuffer::createUninitialized(vfs.m_max_vnode_count * 256);
auto buffer = ByteBuffer::create_uninitialized(vfs.m_max_vnode_count * 256);
char* ptr = (char*)buffer.pointer();
for (size_t i = 0; i < vfs.m_max_vnode_count; ++i) {
auto& vnode = vfs.m_nodes[i];
@ -362,7 +362,7 @@ ByteBuffer procfs$vnodes()
String path;
if (vnode.core_inode())
path = vfs.absolute_path(*vnode.core_inode());
if (path.isEmpty()) {
if (path.is_empty()) {
if (auto* dev = vnode.characterDevice()) {
if (dev->is_tty())
path = static_cast<const TTY*>(dev)->tty_name();

View file

@ -39,7 +39,7 @@ static String& hostnameStorage(InterruptDisabler&)
static String getHostname()
{
InterruptDisabler disabler;
return hostnameStorage(disabler).isolatedCopy();
return hostnameStorage(disabler).isolated_copy();
}
CoolGlobals* g_cool_globals;
@ -59,7 +59,7 @@ Vector<Process*> Process::allProcesses()
{
InterruptDisabler disabler;
Vector<Process*> processes;
processes.ensureCapacity(g_processes->sizeSlow());
processes.ensureCapacity(g_processes->size_slow());
for (auto* process = g_processes->head(); process; process = process->next())
processes.append(process);
return processes;
@ -278,7 +278,7 @@ pid_t Process::sys$fork(RegisterDump& regs)
int Process::do_exec(const String& path, Vector<String>&& arguments, Vector<String>&& environment)
{
auto parts = path.split('/');
if (parts.isEmpty())
if (parts.is_empty())
return -ENOENT;
int error;
@ -473,7 +473,7 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid,
{
// FIXME: Don't split() the path twice (sys$spawn also does it...)
auto parts = path.split('/');
if (arguments.isEmpty()) {
if (arguments.is_empty()) {
arguments.append(parts.last());
}
RetainPtr<Vnode> cwd;
@ -1239,7 +1239,7 @@ int Process::sys$getcwd(char* buffer, size_t size)
return -EFAULT;
ASSERT(cwd_inode());
auto path = VFS::the().absolute_path(*cwd_inode());
if (path.isNull())
if (path.is_null())
return -EINVAL;
if (size < path.length() + 1)
return -ERANGE;

View file

@ -123,7 +123,7 @@ bool Scheduler::pick_next()
auto* prevHead = g_processes->head();
for (;;) {
// Move head to tail.
g_processes->append(g_processes->removeHead());
g_processes->append(g_processes->remove_head());
auto* process = g_processes->head();
if (process->state() == Process::Runnable || process->state() == Process::Running) {

View file

@ -28,7 +28,7 @@ static word s_gdtLength;
word gdt_alloc_entry()
{
ASSERT(s_gdt_freelist);
ASSERT(!s_gdt_freelist->isEmpty());
ASSERT(!s_gdt_freelist->is_empty());
return s_gdt_freelist->takeLast();
}

View file

@ -87,7 +87,7 @@ static void loadKsyms(const ByteBuffer& buffer)
kprintf("Loading ksyms: \033[s");
while (bufptr < buffer.endPointer()) {
while (bufptr < buffer.end_pointer()) {
for (unsigned i = 0; i < 8; ++i)
address = (address << 4) | parseHexDigit(*(bufptr++));
bufptr += 3;
@ -276,7 +276,7 @@ void init()
MemoryManager::initialize();
VFS::initialize_globals();
StringImpl::initializeGlobals();
StringImpl::initialize_globals();
PIT::initialize();