diff options
author | Alexis211 <alexis211@gmail.com> | 2009-10-18 18:46:59 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-10-18 18:46:59 +0200 |
commit | 776753bfa0c411f4b1a5680409104904961fcbeb (patch) | |
tree | 8e1d90bbc91a6925b86adbda9d91f6be50fd2388 /Source/Library | |
parent | ccf807eb4ff541bb849c4f370d34123cb23d7d76 (diff) | |
download | Melon-776753bfa0c411f4b1a5680409104904961fcbeb.tar.gz Melon-776753bfa0c411f4b1a5680409104904961fcbeb.zip |
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.
Diffstat (limited to 'Source/Library')
-rw-r--r-- | Source/Library/Common/Bitset.class.cpp | 4 | ||||
-rw-r--r-- | Source/Library/Common/SimpleList.class.h | 4 | ||||
-rw-r--r-- | Source/Library/Common/Vector.class.cpp | 16 | ||||
-rw-r--r-- | Source/Library/Makefile | 1 |
4 files changed, 13 insertions, 12 deletions
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<T>* delThis() { SimpleList<T>* ret = m_next; - Mem::kfree(this); + Mem::free(this); return ret; } @@ -44,7 +44,7 @@ class SimpleList { if (m_next == 0) return; SimpleList<T>* temp = m_next; m_next = m_next->m_next; - Mem::kfree(temp); + Mem::free(temp); } SimpleList<T>* 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 <typename T> @@ -25,7 +25,7 @@ Vector<T>::Vector(u32int size) { template <typename T> Vector<T>::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 <typename T> Vector<T>::Vector(const Vector<T> &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<T>& Vector<T>::operator= (const Vector<T> &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<T>::operator[] (u32int index) const { template <typename T> void Vector<T>::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<T>::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; } diff --git a/Source/Library/Makefile b/Source/Library/Makefile index 028e7a4..a4b9b6a 100644 --- a/Source/Library/Makefile +++ b/Source/Library/Makefile @@ -15,6 +15,7 @@ Objects = Common/WChar.class.uo \ Common/Mutex.class.uo \ Common/Heap.class.uo \ Common/Heap-index.class.uo \ + Common/String.class.uo \ Userland/Syscall/Syscall.wtf.uo \ Userland/Syscall/RessourceCaller.class.uo \ Userland/Start.uo |