From 776753bfa0c411f4b1a5680409104904961fcbeb Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 18 Oct 2009 18:46:59 +0200 Subject: Mem::kalloc and Mem::kfree renamed to Mem::alloc and Mem::kfree I renamed them so that they could have the same name in userland and in kernel space. We'll just know that if we're writing kernel code then we are allocating stuff in kernel memory, and if we're writing user code then we're allocating userland memory. --- Source/Library/Common/Bitset.class.cpp | 4 ++-- Source/Library/Common/SimpleList.class.h | 4 ++-- Source/Library/Common/Vector.class.cpp | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'Source/Library/Common') diff --git a/Source/Library/Common/Bitset.class.cpp b/Source/Library/Common/Bitset.class.cpp index ec4e62c..a8d7ec8 100644 --- a/Source/Library/Common/Bitset.class.cpp +++ b/Source/Library/Common/Bitset.class.cpp @@ -4,7 +4,7 @@ Bitset::Bitset() { } Bitset::Bitset(u32int size) { - init(size, (u32int*)Mem::kalloc(INDEX_FROM_BIT(size))); + init(size, (u32int*)Mem::alloc(INDEX_FROM_BIT(size))); } Bitset::Bitset(u32int size, u32int *ptr) { @@ -12,7 +12,7 @@ Bitset::Bitset(u32int size, u32int *ptr) { } Bitset::~Bitset() { - Mem::kfree(m_data); + Mem::free(m_data); } void Bitset::init(u32int size, u32int *ptr) { diff --git a/Source/Library/Common/SimpleList.class.h b/Source/Library/Common/SimpleList.class.h index 3e0f968..7b731db 100644 --- a/Source/Library/Common/SimpleList.class.h +++ b/Source/Library/Common/SimpleList.class.h @@ -36,7 +36,7 @@ class SimpleList { SimpleList* delThis() { SimpleList* ret = m_next; - Mem::kfree(this); + Mem::free(this); return ret; } @@ -44,7 +44,7 @@ class SimpleList { if (m_next == 0) return; SimpleList* temp = m_next; m_next = m_next->m_next; - Mem::kfree(temp); + Mem::free(temp); } SimpleList* removeOnce(const T& value) { diff --git a/Source/Library/Common/Vector.class.cpp b/Source/Library/Common/Vector.class.cpp index 02ae9be..c546a42 100644 --- a/Source/Library/Common/Vector.class.cpp +++ b/Source/Library/Common/Vector.class.cpp @@ -4,7 +4,7 @@ using namespace CMem; //strlen and memcpy for (u32int i = 0; i < m_size; i++) { \ m_data[i].~T(); \ } \ - Mem::kfree(m_data); \ + Mem::free(m_data); \ } template @@ -25,7 +25,7 @@ Vector::Vector(u32int size) { template Vector::Vector(u32int size, const T& value) { //DEBUG_HEX((u32int)this); DEBUG(" NEW FILLED"); - //m_data = (T*)Mem::kalloc(size * sizeof(T)); + //m_data = (T*)Mem::alloc(size * sizeof(T)); m_data = new T[size]; m_size = size; for (u32int i = 0; i < m_size; i++) { @@ -40,7 +40,7 @@ template Vector::Vector(const Vector &other) { //DEBUG_HEX((u32int)this); DEBUG(" COPY REF"); m_size = other.m_size; - m_data = (T*)Mem::kalloc(m_size * sizeof(T)); + m_data = (T*)Mem::alloc(m_size * sizeof(T)); for (u32int i = 0; i < m_size; i++) { new(&m_data[i]) T(other.m_data[i]); } @@ -51,7 +51,7 @@ Vector& Vector::operator= (const Vector &other) { //DEBUG_HEX((u32int)this); DEBUG(" COPY EQ"); DELDATA; m_size = other.m_size; - m_data = (T*)Mem::kalloc(m_size * sizeof(T)); + m_data = (T*)Mem::alloc(m_size * sizeof(T)); for (u32int i = 0; i < m_size; i++) { new(&m_data[i]) T(other.m_data[i]); } @@ -72,14 +72,14 @@ T& Vector::operator[] (u32int index) const { template void Vector::push(const T& element) { - T* newdata = (T*)Mem::kalloc((m_size + 1) * sizeof(T)); + T* newdata = (T*)Mem::alloc((m_size + 1) * sizeof(T)); if (m_size != 0 and m_data != 0) { memcpy((u8int*)newdata, (const u8int*) m_data, m_size * sizeof(T)); } new(&newdata[m_size]) T(element); //Construct by copy //newdata[m_size] = element; m_size++; - Mem::kfree(m_data); + Mem::free(m_data); m_data = newdata; } @@ -99,9 +99,9 @@ void Vector::pop() { m_size--; //delete(&m_data[m_size], &m_data[m_size]); //implicitly call destructor with placement delete m_data[m_size].~T(); //Call destructor - T* newdata = (T*)Mem::kalloc(m_size * sizeof(T)); + T* newdata = (T*)Mem::alloc(m_size * sizeof(T)); memcpy((u8int*)newdata, (const u8int*) m_data, m_size * sizeof(T)); - Mem::kfree(m_data); + Mem::free(m_data); m_data = newdata; } -- cgit v1.2.3