Browse Source

Coding style fixes in AK.

Andreas Kling 6 years ago
parent
commit
b75ee4aacb

+ 6 - 6
AK/DoublyLinkedList.h

@@ -63,8 +63,8 @@ public:
         bool operator==(const Iterator& other) const { return m_node == other.m_node; }
         bool operator==(const Iterator& other) const { return m_node == other.m_node; }
         Iterator& operator++() { m_node = m_node->next; return *this; }
         Iterator& operator++() { m_node = m_node->next; return *this; }
         T& operator*() { return m_node->value; }
         T& operator*() { return m_node->value; }
-        bool isEnd() const { return !m_node; }
-        static Iterator universalEnd() { return Iterator(nullptr); }
+        bool is_end() const { return !m_node; }
+        static Iterator universal_end() { return Iterator(nullptr); }
     private:
     private:
         friend class DoublyLinkedList;
         friend class DoublyLinkedList;
         explicit Iterator(DoublyLinkedList::Node* node) : m_node(node) { }
         explicit Iterator(DoublyLinkedList::Node* node) : m_node(node) { }
@@ -72,7 +72,7 @@ public:
     };
     };
 
 
     Iterator begin() { return Iterator(m_head); }
     Iterator begin() { return Iterator(m_head); }
-    Iterator end() { return Iterator::universalEnd(); }
+    Iterator end() { return Iterator::universal_end(); }
 
 
     class ConstIterator {
     class ConstIterator {
     public:
     public:
@@ -80,8 +80,8 @@ public:
         bool operator==(const ConstIterator& other) const { return m_node == other.m_node; }
         bool operator==(const ConstIterator& other) const { return m_node == other.m_node; }
         ConstIterator& operator++() { m_node = m_node->next; return *this; }
         ConstIterator& operator++() { m_node = m_node->next; return *this; }
         const T& operator*() const { return m_node->value; }
         const T& operator*() const { return m_node->value; }
-        bool isEnd() const { return !m_node; }
-        static ConstIterator universalEnd() { return ConstIterator(nullptr); }
+        bool is_end() const { return !m_node; }
+        static ConstIterator universal_end() { return ConstIterator(nullptr); }
     private:
     private:
         friend class DoublyLinkedList;
         friend class DoublyLinkedList;
         explicit ConstIterator(const DoublyLinkedList::Node* node) : m_node(node) { }
         explicit ConstIterator(const DoublyLinkedList::Node* node) : m_node(node) { }
@@ -89,7 +89,7 @@ public:
     };
     };
 
 
     ConstIterator begin() const { return ConstIterator(m_head); }
     ConstIterator begin() const { return ConstIterator(m_head); }
-    ConstIterator end() const { return ConstIterator::universalEnd(); }
+    ConstIterator end() const { return ConstIterator::universal_end(); }
 
 
     ConstIterator find(const T& value) const
     ConstIterator find(const T& value) const
     {
     {

+ 1 - 1
AK/FileSystemPath.cpp

@@ -23,7 +23,7 @@ bool FileSystemPath::canonicalize(bool resolve_symbolic_links)
             continue;
             continue;
         if (part == "..") {
         if (part == "..") {
             if (!canonical_parts.is_empty())
             if (!canonical_parts.is_empty())
-                canonical_parts.takeLast();
+                canonical_parts.take_last();
             continue;
             continue;
         }
         }
         if (!part.is_empty())
         if (!part.is_empty())

+ 88 - 88
AK/HashTable.h

@@ -59,73 +59,73 @@ public:
     public:
     public:
         bool operator!=(const Iterator& other) const
         bool operator!=(const Iterator& other) const
         {
         {
-            if (m_isEnd && other.m_isEnd)
+            if (m_is_end && other.m_is_end)
                 return false;
                 return false;
             return &m_table != &other.m_table
             return &m_table != &other.m_table
-                || m_isEnd != other.m_isEnd
-                || m_bucketIndex != other.m_bucketIndex
-                || m_bucketIterator != other.m_bucketIterator;
+                || m_is_end != other.m_is_end
+                || m_bucket_index != other.m_bucket_index
+                || m_bucket_iterator != other.m_bucket_iterator;
         }
         }
         bool operator==(const Iterator& other) const { return !(*this != other); }
         bool operator==(const Iterator& other) const { return !(*this != other); }
         T& operator*()
         T& operator*()
         {
         {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
-            kprintf("retrieve { bucketIndex: %u, isEnd: %u }\n", m_bucketIndex, m_isEnd);
+            kprintf("retrieve { bucket_index: %u, is_end: %u }\n", m_bucket_index, m_is_end);
 #endif
 #endif
-            return *m_bucketIterator;
+            return *m_bucket_iterator;
         }
         }
         Iterator& operator++()
         Iterator& operator++()
         {
         {
-            skipToNext();
+            skip_to_next();
             return *this;
             return *this;
         }
         }
 
 
-        void skipToNext()
+        void skip_to_next()
         {
         {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
             unsigned pass = 0;
             unsigned pass = 0;
 #endif
 #endif
-            while (!m_isEnd) {
+            while (!m_is_end) {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
                 ++pass;
                 ++pass;
-                kprintf("skipToNext pass %u, m_bucketIndex=%u\n", pass, m_bucketIndex);
+                kprintf("skip_to_next pass %u, m_bucket_index=%u\n", pass, m_bucket_index);
 #endif
 #endif
-                if (m_bucketIterator.isEnd()) {
-                    ++m_bucketIndex;
-                    if (m_bucketIndex >= m_table.capacity()) {
-                        m_isEnd = true;
+                if (m_bucket_iterator.is_end()) {
+                    ++m_bucket_index;
+                    if (m_bucket_index >= m_table.capacity()) {
+                        m_is_end = true;
                         return;
                         return;
                     }
                     }
-                    m_bucketIterator = m_table.m_buckets[m_bucketIndex].chain.begin();
+                    m_bucket_iterator = m_table.m_buckets[m_bucket_index].chain.begin();
                 } else {
                 } else {
-                    ++m_bucketIterator;
+                    ++m_bucket_iterator;
                 }
                 }
-                if (!m_bucketIterator.isEnd())
+                if (!m_bucket_iterator.is_end())
                     return;
                     return;
             }
             }
         }
         }
     private:
     private:
         friend class HashTable;
         friend class HashTable;
-        explicit Iterator(HashTable& table, bool isEnd, typename DoublyLinkedList<T>::Iterator bucketIterator = DoublyLinkedList<T>::Iterator::universalEnd(), unsigned bucketIndex = 0)
+        explicit Iterator(HashTable& table, bool is_end, typename DoublyLinkedList<T>::Iterator bucket_iterator = DoublyLinkedList<T>::Iterator::universal_end(), unsigned bucket_index = 0)
             : m_table(table)
             : m_table(table)
-            , m_bucketIndex(bucketIndex)
-            , m_isEnd(isEnd)
-            , m_bucketIterator(bucketIterator)
+            , m_bucket_index(bucket_index)
+            , m_is_end(is_end)
+            , m_bucket_iterator(bucket_iterator)
         {
         {
-            if (!isEnd && !m_table.is_empty() && !(m_bucketIterator != DoublyLinkedList<T>::Iterator::universalEnd())) {
+            if (!is_end && !m_table.is_empty() && !(m_bucket_iterator != DoublyLinkedList<T>::Iterator::universal_end())) {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
                 kprintf("bucket iterator init!\n");
                 kprintf("bucket iterator init!\n");
 #endif
 #endif
-                m_bucketIterator = m_table.m_buckets[0].chain.begin();
-                if (m_bucketIterator.isEnd())
-                    skipToNext();
+                m_bucket_iterator = m_table.m_buckets[0].chain.begin();
+                if (m_bucket_iterator.is_end())
+                    skip_to_next();
             }
             }
         }
         }
 
 
         HashTable& m_table;
         HashTable& m_table;
-        unsigned m_bucketIndex { 0 };
-        bool m_isEnd { false };
-        typename DoublyLinkedList<T>::Iterator m_bucketIterator;
+        unsigned m_bucket_index { 0 };
+        bool m_is_end { false };
+        typename DoublyLinkedList<T>::Iterator m_bucket_iterator;
     };
     };
 
 
     Iterator begin() { return Iterator(*this, is_empty()); }
     Iterator begin() { return Iterator(*this, is_empty()); }
@@ -135,75 +135,75 @@ public:
     public:
     public:
         bool operator!=(const ConstIterator& other) const
         bool operator!=(const ConstIterator& other) const
         {
         {
-            if (m_isEnd && other.m_isEnd)
+            if (m_is_end && other.m_is_end)
                 return false;
                 return false;
             return &m_table != &other.m_table
             return &m_table != &other.m_table
-                || m_isEnd != other.m_isEnd
-                || m_bucketIndex != other.m_bucketIndex
-                || m_bucketIterator != other.m_bucketIterator;
+                || m_is_end != other.m_is_end
+                || m_bucket_index != other.m_bucket_index
+                || m_bucket_iterator != other.m_bucket_iterator;
         }
         }
         bool operator==(const ConstIterator& other) const { return !(*this != other); }
         bool operator==(const ConstIterator& other) const { return !(*this != other); }
         const T& operator*() const
         const T& operator*() const
         {
         {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
-            kprintf("retrieve { bucketIndex: %u, isEnd: %u }\n", m_bucketIndex, m_isEnd);
+            kprintf("retrieve { bucket_index: %u, is_end: %u }\n", m_bucket_index, m_is_end);
 #endif
 #endif
-            return *m_bucketIterator;
+            return *m_bucket_iterator;
         }
         }
         ConstIterator& operator++()
         ConstIterator& operator++()
         {
         {
-            skipToNext();
+            skip_to_next();
             return *this;
             return *this;
         }
         }
 
 
-        void skipToNext()
+        void skip_to_next()
         {
         {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
             unsigned pass = 0;
             unsigned pass = 0;
 #endif
 #endif
-            while (!m_isEnd) {
+            while (!m_is_end) {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
                 ++pass;
                 ++pass;
-                kprintf("skipToNext pass %u, m_bucketIndex=%u\n", pass, m_bucketIndex);
+                kprintf("skip_to_next pass %u, m_bucket_index=%u\n", pass, m_bucket_index);
 #endif
 #endif
-                if (m_bucketIterator.isEnd()) {
-                    ++m_bucketIndex;
-                    if (m_bucketIndex >= m_table.capacity()) {
-                        m_isEnd = true;
+                if (m_bucket_iterator.is_end()) {
+                    ++m_bucket_index;
+                    if (m_bucket_index >= m_table.capacity()) {
+                        m_is_end = true;
                         return;
                         return;
                     }
                     }
-                    const DoublyLinkedList<T>& chain = m_table.m_buckets[m_bucketIndex].chain;
-                    m_bucketIterator = chain.begin();
+                    const DoublyLinkedList<T>& chain = m_table.m_buckets[m_bucket_index].chain;
+                    m_bucket_iterator = chain.begin();
                 } else {
                 } else {
-                    ++m_bucketIterator;
+                    ++m_bucket_iterator;
                 }
                 }
-                if (!m_bucketIterator.isEnd())
+                if (!m_bucket_iterator.is_end())
                     return;
                     return;
             }
             }
         }
         }
     private:
     private:
         friend class HashTable;
         friend class HashTable;
-        ConstIterator(const HashTable& table, bool isEnd, typename DoublyLinkedList<T>::ConstIterator bucketIterator = DoublyLinkedList<T>::ConstIterator::universalEnd(), unsigned bucketIndex = 0)
+        ConstIterator(const HashTable& table, bool is_end, typename DoublyLinkedList<T>::ConstIterator bucket_iterator = DoublyLinkedList<T>::ConstIterator::universal_end(), unsigned bucket_index = 0)
             : m_table(table)
             : m_table(table)
-            , m_bucketIndex(bucketIndex)
-            , m_isEnd(isEnd)
-            , m_bucketIterator(bucketIterator)
+            , m_bucket_index(bucket_index)
+            , m_is_end(is_end)
+            , m_bucket_iterator(bucket_iterator)
         {
         {
-            if (!isEnd && !m_table.is_empty() && !(m_bucketIterator != DoublyLinkedList<T>::ConstIterator::universalEnd())) {
+            if (!is_end && !m_table.is_empty() && !(m_bucket_iterator != DoublyLinkedList<T>::ConstIterator::universal_end())) {
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
                 kprintf("const bucket iterator init!\n");
                 kprintf("const bucket iterator init!\n");
 #endif
 #endif
                 const DoublyLinkedList<T>& chain = m_table.m_buckets[0].chain;
                 const DoublyLinkedList<T>& chain = m_table.m_buckets[0].chain;
-                m_bucketIterator = chain.begin();
-                if (m_bucketIterator.isEnd())
-                    skipToNext();
+                m_bucket_iterator = chain.begin();
+                if (m_bucket_iterator.is_end())
+                    skip_to_next();
             }
             }
         }
         }
 
 
         const HashTable& m_table;
         const HashTable& m_table;
-        unsigned m_bucketIndex { 0 };
-        bool m_isEnd { false };
-        typename DoublyLinkedList<T>::ConstIterator m_bucketIterator;
+        unsigned m_bucket_index { 0 };
+        bool m_is_end { false };
+        typename DoublyLinkedList<T>::ConstIterator m_bucket_iterator;
     };
     };
 
 
     ConstIterator begin() const { return ConstIterator(*this, is_empty()); }
     ConstIterator begin() const { return ConstIterator(*this, is_empty()); }
@@ -222,8 +222,8 @@ public:
     void remove(Iterator);
     void remove(Iterator);
 
 
 private:
 private:
-    Bucket& lookup(const T&, unsigned* bucketIndex = nullptr);
-    const Bucket& lookup(const T&, unsigned* bucketIndex = nullptr) const;
+    Bucket& lookup(const T&, unsigned* bucket_index = nullptr);
+    const Bucket& lookup(const T&, unsigned* bucket_index = nullptr) const;
     void rehash(unsigned capacity);
     void rehash(unsigned capacity);
     void insert(const T&);
     void insert(const T&);
     void insert(T&&);
     void insert(T&&);
@@ -274,28 +274,28 @@ void HashTable<T, TraitsForT>::set(const T& value)
 
 
 
 
 template<typename T, typename TraitsForT>
 template<typename T, typename TraitsForT>
-void HashTable<T, TraitsForT>::rehash(unsigned newCapacity)
+void HashTable<T, TraitsForT>::rehash(unsigned new_capacity)
 {
 {
-    newCapacity *= 2;
+    new_capacity *= 2;
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
-    kprintf("rehash to %u buckets\n", newCapacity);
+    kprintf("rehash to %u buckets\n", new_capacity);
 #endif
 #endif
-    auto* newBuckets = new Bucket[newCapacity];
-    auto* oldBuckets = m_buckets;
-    unsigned oldCapacity = m_capacity;
-    m_buckets = newBuckets;
-    m_capacity = newCapacity;
+    auto* new_buckets = new Bucket[new_capacity];
+    auto* old_buckets = m_buckets;
+    unsigned old_capacity = m_capacity;
+    m_buckets = new_buckets;
+    m_capacity = new_capacity;
 
 
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
-    kprintf("reinsert %u buckets\n", oldCapacity);
+    kprintf("reinsert %u buckets\n", old_capacity);
 #endif
 #endif
-    for (unsigned i = 0; i < oldCapacity; ++i) {
-        for (auto& value : oldBuckets[i].chain) {
+    for (unsigned i = 0; i < old_capacity; ++i) {
+        for (auto& value : old_buckets[i].chain) {
             insert(move(value));
             insert(move(value));
         }
         }
     }
     }
 
 
-    delete [] oldBuckets;
+    delete [] old_buckets;
 }
 }
 
 
 template<typename T, typename TraitsForT>
 template<typename T, typename TraitsForT>
@@ -338,11 +338,11 @@ auto HashTable<T, TraitsForT>::find(const T& value) -> Iterator
 {
 {
     if (is_empty())
     if (is_empty())
         return end();
         return end();
-    unsigned bucketIndex;
-    auto& bucket = lookup(value, &bucketIndex);
-    auto bucketIterator = bucket.chain.find(value);
-    if (bucketIterator != bucket.chain.end())
-        return Iterator(*this, false, bucketIterator, bucketIndex);
+    unsigned bucket_index;
+    auto& bucket = lookup(value, &bucket_index);
+    auto bucket_iterator = bucket.chain.find(value);
+    if (bucket_iterator != bucket.chain.end())
+        return Iterator(*this, false, bucket_iterator, bucket_index);
     return end();
     return end();
 }
 }
 
 
@@ -351,11 +351,11 @@ auto HashTable<T, TraitsForT>::find(const T& value) const -> ConstIterator
 {
 {
     if (is_empty())
     if (is_empty())
         return end();
         return end();
-    unsigned bucketIndex;
-    auto& bucket = lookup(value, &bucketIndex);
-    auto bucketIterator = bucket.chain.find(value);
-    if (bucketIterator != bucket.chain.end())
-        return ConstIterator(*this, false, bucketIterator, bucketIndex);
+    unsigned bucket_index;
+    auto& bucket = lookup(value, &bucket_index);
+    auto bucket_iterator = bucket.chain.find(value);
+    if (bucket_iterator != bucket.chain.end())
+        return ConstIterator(*this, false, bucket_iterator, bucket_index);
     return end();
     return end();
 }
 }
 
 
@@ -363,12 +363,12 @@ template<typename T, typename TraitsForT>
 void HashTable<T, TraitsForT>::remove(Iterator it)
 void HashTable<T, TraitsForT>::remove(Iterator it)
 {
 {
     ASSERT(!is_empty());
     ASSERT(!is_empty());
-    m_buckets[it.m_bucketIndex].chain.remove(it.m_bucketIterator);
+    m_buckets[it.m_bucket_index].chain.remove(it.m_bucket_iterator);
     --m_size;
     --m_size;
 }
 }
 
 
 template<typename T, typename TraitsForT>
 template<typename T, typename TraitsForT>
-typename HashTable<T, TraitsForT>::Bucket& HashTable<T, TraitsForT>::lookup(const T& value, unsigned* bucketIndex)
+typename HashTable<T, TraitsForT>::Bucket& HashTable<T, TraitsForT>::lookup(const T& value, unsigned* bucket_index)
 {
 {
     unsigned hash = TraitsForT::hash(value);
     unsigned hash = TraitsForT::hash(value);
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
@@ -376,13 +376,13 @@ typename HashTable<T, TraitsForT>::Bucket& HashTable<T, TraitsForT>::lookup(cons
     TraitsForT::dump(value);
     TraitsForT::dump(value);
     kprintf(" is %u\n", hash);
     kprintf(" is %u\n", hash);
 #endif
 #endif
-    if (bucketIndex)
-        *bucketIndex = hash % m_capacity;
+    if (bucket_index)
+        *bucket_index = hash % m_capacity;
     return m_buckets[hash % m_capacity];
     return m_buckets[hash % m_capacity];
 }
 }
 
 
 template<typename T, typename TraitsForT>
 template<typename T, typename TraitsForT>
-const typename HashTable<T, TraitsForT>::Bucket& HashTable<T, TraitsForT>::lookup(const T& value, unsigned* bucketIndex) const
+const typename HashTable<T, TraitsForT>::Bucket& HashTable<T, TraitsForT>::lookup(const T& value, unsigned* bucket_index) const
 {
 {
     unsigned hash = TraitsForT::hash(value);
     unsigned hash = TraitsForT::hash(value);
 #ifdef HASHTABLE_DEBUG
 #ifdef HASHTABLE_DEBUG
@@ -390,8 +390,8 @@ const typename HashTable<T, TraitsForT>::Bucket& HashTable<T, TraitsForT>::looku
     TraitsForT::dump(value);
     TraitsForT::dump(value);
     kprintf(" is %u\n", hash);
     kprintf(" is %u\n", hash);
 #endif
 #endif
-    if (bucketIndex)
-        *bucketIndex = hash % m_capacity;
+    if (bucket_index)
+        *bucket_index = hash % m_capacity;
     return m_buckets[hash % m_capacity];
     return m_buckets[hash % m_capacity];
 }
 }
 
 

+ 6 - 6
AK/SinglyLinkedList.h

@@ -61,8 +61,8 @@ public:
         bool operator!=(const Iterator& other) { return m_node != other.m_node; }
         bool operator!=(const Iterator& other) { return m_node != other.m_node; }
         Iterator& operator++() { m_node = m_node->next; return *this; }
         Iterator& operator++() { m_node = m_node->next; return *this; }
         T& operator*() { return m_node->value; }
         T& operator*() { return m_node->value; }
-        bool isEnd() const { return !m_node; }
-        static Iterator universalEnd() { return Iterator(nullptr); }
+        bool is_end() const { return !m_node; }
+        static Iterator universal_end() { return Iterator(nullptr); }
     private:
     private:
         friend class SinglyLinkedList;
         friend class SinglyLinkedList;
         explicit Iterator(SinglyLinkedList::Node* node) : m_node(node) { }
         explicit Iterator(SinglyLinkedList::Node* node) : m_node(node) { }
@@ -70,15 +70,15 @@ public:
     };
     };
 
 
     Iterator begin() { return Iterator(m_head); }
     Iterator begin() { return Iterator(m_head); }
-    Iterator end() { return Iterator::universalEnd(); }
+    Iterator end() { return Iterator::universal_end(); }
 
 
     class ConstIterator {
     class ConstIterator {
     public:
     public:
         bool operator!=(const ConstIterator& other) { return m_node != other.m_node; }
         bool operator!=(const ConstIterator& other) { return m_node != other.m_node; }
         ConstIterator& operator++() { m_node = m_node->next; return *this; }
         ConstIterator& operator++() { m_node = m_node->next; return *this; }
         const T& operator*() const { return m_node->value; }
         const T& operator*() const { return m_node->value; }
-        bool isEnd() const { return !m_node; }
-        static ConstIterator universalEnd() { return ConstIterator(nullptr); }
+        bool is_end() const { return !m_node; }
+        static ConstIterator universal_end() { return ConstIterator(nullptr); }
     private:
     private:
         friend class SinglyLinkedList;
         friend class SinglyLinkedList;
         explicit ConstIterator(const SinglyLinkedList::Node* node) : m_node(node) { }
         explicit ConstIterator(const SinglyLinkedList::Node* node) : m_node(node) { }
@@ -86,7 +86,7 @@ public:
     };
     };
 
 
     ConstIterator begin() const { return ConstIterator(m_head); }
     ConstIterator begin() const { return ConstIterator(m_head); }
-    ConstIterator end() const { return ConstIterator::universalEnd(); }
+    ConstIterator end() const { return ConstIterator::universal_end(); }
 
 
     ConstIterator find(const T& value) const
     ConstIterator find(const T& value) const
     {
     {

+ 12 - 12
AK/Vector.h

@@ -77,7 +77,7 @@ public:
 
 
     Vector(const Vector& other)
     Vector(const Vector& other)
     {
     {
-        ensureCapacity(other.size());
+        ensure_capacity(other.size());
         for (size_t i = 0; i < other.size(); ++i)
         for (size_t i = 0; i < other.size(); ++i)
             unchecked_append(other[i]);
             unchecked_append(other[i]);
     }
     }
@@ -137,7 +137,7 @@ public:
     const T& last() const { return at(size() - 1); }
     const T& last() const { return at(size() - 1); }
     T& last() { return at(size() - 1); }
     T& last() { return at(size() - 1); }
 
 
-    T takeLast()
+    T take_last()
     {
     {
         ASSERT(!is_empty());
         ASSERT(!is_empty());
         T value = move(last());
         T value = move(last());
@@ -163,7 +163,7 @@ public:
     {
     {
         if (this != &other) {
         if (this != &other) {
             clear();
             clear();
-            ensureCapacity(other.size());
+            ensure_capacity(other.size());
             for (const auto& v : other)
             for (const auto& v : other)
                 unchecked_append(v);
                 unchecked_append(v);
         }
         }
@@ -173,7 +173,7 @@ public:
     void append(Vector<T>&& other)
     void append(Vector<T>&& other)
     {
     {
         Vector<T> tmp = move(other);
         Vector<T> tmp = move(other);
-        ensureCapacity(size() + tmp.size());
+        ensure_capacity(size() + tmp.size());
         for (auto&& v : tmp) {
         for (auto&& v : tmp) {
             unchecked_append(move(v));
             unchecked_append(move(v));
         }
         }
@@ -194,32 +194,32 @@ public:
 
 
     void append(T&& value)
     void append(T&& value)
     {
     {
-        ensureCapacity(size() + 1);
+        ensure_capacity(size() + 1);
         new (m_impl->slot(m_impl->m_size)) T(move(value));
         new (m_impl->slot(m_impl->m_size)) T(move(value));
         ++m_impl->m_size;
         ++m_impl->m_size;
     }
     }
 
 
     void append(const T& value)
     void append(const T& value)
     {
     {
-        ensureCapacity(size() + 1);
+        ensure_capacity(size() + 1);
         new (m_impl->slot(m_impl->m_size)) T(value);
         new (m_impl->slot(m_impl->m_size)) T(value);
         ++m_impl->m_size;
         ++m_impl->m_size;
     }
     }
 
 
     void append(const T* values, size_t count)
     void append(const T* values, size_t count)
     {
     {
-        ensureCapacity(size() + count);
+        ensure_capacity(size() + count);
         for (size_t i = 0; i < count; ++i)
         for (size_t i = 0; i < count; ++i)
             new (m_impl->slot(m_impl->m_size + i)) T(values[i]);
             new (m_impl->slot(m_impl->m_size + i)) T(values[i]);
         m_impl->m_size += count;
         m_impl->m_size += count;
     }
     }
 
 
-    void ensureCapacity(size_t neededCapacity)
+    void ensure_capacity(size_t neededCapacity)
     {
     {
         if (capacity() >= neededCapacity)
         if (capacity() >= neededCapacity)
             return;
             return;
-        size_t newCapacity = paddedCapacity(neededCapacity);
-        auto newImpl = VectorImpl<T, Allocator>::create(newCapacity);
+        size_t new_capacity = padded_capacity(neededCapacity);
+        auto newImpl = VectorImpl<T, Allocator>::create(new_capacity);
         if (m_impl) {
         if (m_impl) {
             newImpl->m_size = m_impl->m_size;
             newImpl->m_size = m_impl->m_size;
             for (size_t i = 0; i < size(); ++i) {
             for (size_t i = 0; i < size(); ++i) {
@@ -236,7 +236,7 @@ public:
         ASSERT(new_size >= size());
         ASSERT(new_size >= size());
         if (!new_size)
         if (!new_size)
             return;
             return;
-        ensureCapacity(new_size);
+        ensure_capacity(new_size);
         for (size_t i = size(); i < new_size; ++i)
         for (size_t i = size(); i < new_size; ++i)
             new (m_impl->slot(i)) T;
             new (m_impl->slot(i)) T;
         m_impl->m_size = new_size;
         m_impl->m_size = new_size;
@@ -273,7 +273,7 @@ public:
     ConstIterator end() const { return ConstIterator(*this, size()); }
     ConstIterator end() const { return ConstIterator(*this, size()); }
 
 
 //private:
 //private:
-    static size_t paddedCapacity(size_t capacity)
+    static size_t padded_capacity(size_t capacity)
     {
     {
         return max(size_t(4), capacity + (capacity / 4) + 4);
         return max(size_t(4), capacity + (capacity / 4) + 4);
     }
     }

+ 1 - 1
AK/test.cpp

@@ -126,7 +126,7 @@ int main(int c, char** v)
     strings.append("f");
     strings.append("f");
     strings.append("g");
     strings.append("g");
 
 
-    auto g = strings.takeLast();
+    auto g = strings.take_last();
 
 
     for (unsigned i = 0; i < strings.size(); ++i) {
     for (unsigned i = 0; i < strings.size(); ++i) {
         printf("[%u]: '%s'\n", i, strings[i].characters());
         printf("[%u]: '%s'\n", i, strings[i].characters());

+ 3 - 3
Kernel/MemoryManager.cpp

@@ -84,7 +84,7 @@ void MemoryManager::initialize_paging()
 #endif
 #endif
     for (size_t i = (4 * MB); i < (32 * MB); i += PAGE_SIZE)
     for (size_t i = (4 * MB); i < (32 * MB); i += PAGE_SIZE)
         m_free_physical_pages.append(adopt(*new PhysicalPage(PhysicalAddress(i), false)));
         m_free_physical_pages.append(adopt(*new PhysicalPage(PhysicalAddress(i), false)));
-    m_quickmap_addr = LinearAddress(m_free_physical_pages.takeLast().leakRef()->paddr().get());
+    m_quickmap_addr = LinearAddress(m_free_physical_pages.take_last().leakRef()->paddr().get());
 #ifdef MM_DEBUG
 #ifdef MM_DEBUG
     dbgprintf("MM: Quickmap will use P%x\n", m_quickmap_addr.get());
     dbgprintf("MM: Quickmap will use P%x\n", m_quickmap_addr.get());
     dbgprintf("MM: Installing page directory\n");
     dbgprintf("MM: Installing page directory\n");
@@ -357,7 +357,7 @@ RetainPtr<PhysicalPage> MemoryManager::allocate_physical_page()
 #ifdef MM_DEBUG
 #ifdef MM_DEBUG
     dbgprintf("MM: allocate_physical_page vending P%x (%u remaining)\n", m_free_physical_pages.last()->paddr().get(), m_free_physical_pages.size());
     dbgprintf("MM: allocate_physical_page vending P%x (%u remaining)\n", m_free_physical_pages.last()->paddr().get(), m_free_physical_pages.size());
 #endif
 #endif
-    return m_free_physical_pages.takeLast();
+    return m_free_physical_pages.take_last();
 }
 }
 
 
 RetainPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page()
 RetainPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page()
@@ -368,7 +368,7 @@ RetainPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page()
 #ifdef MM_DEBUG
 #ifdef MM_DEBUG
     dbgprintf("MM: allocate_supervisor_physical_page vending P%x (%u remaining)\n", m_free_supervisor_physical_pages.last()->paddr().get(), m_free_supervisor_physical_pages.size());
     dbgprintf("MM: allocate_supervisor_physical_page vending P%x (%u remaining)\n", m_free_supervisor_physical_pages.last()->paddr().get(), m_free_supervisor_physical_pages.size());
 #endif
 #endif
-    return m_free_supervisor_physical_pages.takeLast();
+    return m_free_supervisor_physical_pages.take_last();
 }
 }
 
 
 void MemoryManager::enter_process_paging_scope(Process& process)
 void MemoryManager::enter_process_paging_scope(Process& process)

+ 2 - 2
Kernel/PTYMultiplexer.cpp

@@ -5,7 +5,7 @@
 PTYMultiplexer::PTYMultiplexer()
 PTYMultiplexer::PTYMultiplexer()
     : CharacterDevice(5, 2)
     : CharacterDevice(5, 2)
 {
 {
-    m_freelist.ensureCapacity(4);
+    m_freelist.ensure_capacity(4);
     for (int i = 4; i > 0; --i)
     for (int i = 4; i > 0; --i)
         m_freelist.unchecked_append(adopt(*new MasterPTY(i - 1)));
         m_freelist.unchecked_append(adopt(*new MasterPTY(i - 1)));
 }
 }
@@ -21,7 +21,7 @@ RetainPtr<FileDescriptor> PTYMultiplexer::open(int& error, int options)
         error = -EBUSY;
         error = -EBUSY;
         return nullptr;
         return nullptr;
     }
     }
-    auto master = m_freelist.takeLast();
+    auto master = m_freelist.take_last();
     dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
     dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
     return VFS::the().open(move(master), error, options);
     return VFS::the().open(move(master), error, options);
 }
 }

+ 3 - 3
Kernel/Process.cpp

@@ -63,7 +63,7 @@ Vector<Process*> Process::allProcesses()
 {
 {
     InterruptDisabler disabler;
     InterruptDisabler disabler;
     Vector<Process*> processes;
     Vector<Process*> processes;
-    processes.ensureCapacity(g_processes->size_slow());
+    processes.ensure_capacity(g_processes->size_slow());
     for (auto* process = g_processes->head(); process; process = process->next())
     for (auto* process = g_processes->head(); process; process = process->next())
         processes.append(process);
         processes.append(process);
     return processes;
     return processes;
@@ -380,7 +380,7 @@ int Process::do_exec(const String& path, Vector<String>&& arguments, Vector<Stri
 
 
     Scheduler::prepare_to_modify_tss(*this);
     Scheduler::prepare_to_modify_tss(*this);
 
 
-    m_name = parts.takeLast();
+    m_name = parts.take_last();
 
 
     dword old_esp0 = m_tss.esp0;
     dword old_esp0 = m_tss.esp0;
 
 
@@ -490,7 +490,7 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid,
     if (!cwd)
     if (!cwd)
         cwd = VFS::the().root_inode();
         cwd = VFS::the().root_inode();
 
 
-    auto* process = new Process(parts.takeLast(), uid, gid, parent_pid, Ring3, move(cwd), nullptr, tty);
+    auto* process = new Process(parts.take_last(), uid, gid, parent_pid, Ring3, move(cwd), nullptr, tty);
 
 
     error = process->exec(path, move(arguments), move(environment));
     error = process->exec(path, move(arguments), move(environment));
     if (error != 0) {
     if (error != 0) {

+ 2 - 2
Kernel/i386.cpp

@@ -29,7 +29,7 @@ word gdt_alloc_entry()
 {
 {
     ASSERT(s_gdt_freelist);
     ASSERT(s_gdt_freelist);
     ASSERT(!s_gdt_freelist->is_empty());
     ASSERT(!s_gdt_freelist->is_empty());
-    return s_gdt_freelist->takeLast();
+    return s_gdt_freelist->take_last();
 }
 }
 
 
 void gdt_free_entry(word entry)
 void gdt_free_entry(word entry)
@@ -323,7 +323,7 @@ void gdt_init()
     s_gdtLength = 5;
     s_gdtLength = 5;
 
 
     s_gdt_freelist = new Vector<word, KmallocEternalAllocator>();
     s_gdt_freelist = new Vector<word, KmallocEternalAllocator>();
-    s_gdt_freelist->ensureCapacity(256);
+    s_gdt_freelist->ensure_capacity(256);
     for (size_t i = s_gdtLength; i < 256; ++i)
     for (size_t i = s_gdtLength; i < 256; ++i)
         s_gdt_freelist->append(i * 8);
         s_gdt_freelist->append(i * 8);
 
 

+ 1 - 1
VirtualFileSystem/Ext2FileSystem.cpp

@@ -158,7 +158,7 @@ Vector<unsigned> Ext2FS::block_list_for_inode(const ext2_inode& e2inode) const
     unsigned blockCount = e2inode.i_blocks / (blockSize() / 512);
     unsigned blockCount = e2inode.i_blocks / (blockSize() / 512);
     unsigned blocksRemaining = blockCount;
     unsigned blocksRemaining = blockCount;
     Vector<unsigned> list;
     Vector<unsigned> list;
-    list.ensureCapacity(blocksRemaining);
+    list.ensure_capacity(blocksRemaining);
 
 
     unsigned directCount = min(blockCount, (unsigned)EXT2_NDIR_BLOCKS);
     unsigned directCount = min(blockCount, (unsigned)EXT2_NDIR_BLOCKS);
     for (unsigned i = 0; i < directCount; ++i) {
     for (unsigned i = 0; i < directCount; ++i) {

+ 1 - 1
VirtualFileSystem/SyntheticFileSystem.cpp

@@ -131,7 +131,7 @@ bool SynthFS::remove_file(InodeIndex inode)
     }
     }
 
 
     Vector<InodeIndex> indices_to_remove;
     Vector<InodeIndex> indices_to_remove;
-    indices_to_remove.ensureCapacity(file.m_children.size());
+    indices_to_remove.ensure_capacity(file.m_children.size());
     for (auto& child : file.m_children)
     for (auto& child : file.m_children)
         indices_to_remove.unchecked_append(child->m_metadata.inode.index());
         indices_to_remove.unchecked_append(child->m_metadata.inode.index());
     for (auto& index : indices_to_remove)
     for (auto& index : indices_to_remove)