Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AK: Use direct-list-initialization for Vector::empend() #4564

Merged
merged 1 commit into from
Dec 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AK/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class Vector {
void empend(Args&&... args)
{
grow_capacity(m_size + 1);
new (slot(m_size)) T(forward<Args>(args)...);
new (slot(m_size)) T { forward<Args>(args)... };
++m_size;
}

Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/Ext2FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,8 +1433,8 @@ KResult Ext2FS::create_directory(InodeIdentifier parent_id, const String& name,
#endif

Vector<Ext2FSDirectoryEntry> entries;
entries.empend(".", inode->identifier(), EXT2_FT_DIR);
entries.empend("..", parent_id, EXT2_FT_DIR);
entries.empend(".", inode->identifier(), static_cast<u8>(EXT2_FT_DIR));
entries.empend("..", parent_id, static_cast<u8>(EXT2_FT_DIR));

bool success = static_cast<Ext2FSInode&>(*inode).write_directory(entries);
ASSERT(success);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/LibRegex/RegexByteCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class ByteCode : public Vector<ByteCodeValueType> {
ByteCode bytecode;

bytecode.empend(static_cast<ByteCodeValueType>(OpCodeId::Compare));
bytecode.empend(1); // number of arguments
bytecode.empend(static_cast<u64>(1)); // number of arguments

ByteCode arguments;

Expand All @@ -209,7 +209,7 @@ class ByteCode : public Vector<ByteCodeValueType> {
ByteCode bytecode;

bytecode.empend(static_cast<ByteCodeValueType>(OpCodeId::Compare));
bytecode.empend(1); // number of arguments
bytecode.empend(static_cast<u64>(1)); // number of arguments

ByteCode arguments;

Expand Down
2 changes: 1 addition & 1 deletion Services/LookupServer/DNSRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <ctype.h>
#include <stdlib.h>

#define C_IN 1
const u16 C_IN = 1;

DNSRequest::DNSRequest()
: m_id(arc4random_uniform(UINT16_MAX))
Expand Down