summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Harley2020-01-24 03:39:12 +0000
committerTom Harley2020-01-24 03:39:12 +0000
commit7dd566bbaf37221a21b3724e5211a2a03de93c1e (patch)
treebbe2800b6134766622bbf9fafca25945f4486ec1
parentEdit header comment to not talk about CS3104 (diff)
downloadalloc-7dd566bbaf37221a21b3724e5211a2a03de93c1e.tar.gz
alloc-7dd566bbaf37221a21b3724e5211a2a03de93c1e.zip

Add myalloc.h

-rwxr-xr-xmyalloc.c19
-rw-r--r--myalloc.h16
2 files changed, 17 insertions, 18 deletions
diff --git a/myalloc.c b/myalloc.c
index af20e2f..31923e5 100755
--- a/myalloc.c
+++ b/myalloc.c
@@ -1,7 +1,7 @@
#if 0
(
echo "PROJECT_NAME=alloc"
- echo "INPUT=myalloc.c"
+ echo "INPUT=myalloc.c,myalloc.h"
echo "OPTIMIZE_OUTPUT_FOR_C=YES"
echo "EXTRACT_STATIC=YES"
echo "GENERATE_LATEX=NO"
@@ -258,23 +258,6 @@ static header* unmap_excess_pages(header* h);
*/
static header* more_memory(size_t minimum_size);
-/**
- * @brief Allocates memory for the user to use for data storage.
- *
- * @param size The size of the memory space requested, in bytes.
- * @returns A pointer to memory, at least the size of that requested,
- * that the user can write to, or `NULL` if such memory cannot be
- * allocated.
- */
-void* myalloc(int size);
-
-/**
- * @brief Frees a chunk of memory, allowing other processes to use it.
- *
- * @param ptr A pointer to the start of the memory that should be freed.
- */
-void myfree(void* ptr);
-
#ifdef MYALLOC_DEBUG
#include <stdio.h>
diff --git a/myalloc.h b/myalloc.h
new file mode 100644
index 0000000..42a6259
--- /dev/null
+++ b/myalloc.h
@@ -0,0 +1,16 @@
+/**
+ * @brief Allocates memory for the user to use for data storage.
+ *
+ * @param size The size of the memory space requested, in bytes.
+ * @returns A pointer to memory, at least the size of that requested,
+ * that the user can write to, or `NULL` if such memory cannot be
+ * allocated.
+ */
+void* myalloc(int size);
+
+/**
+ * @brief Frees a chunk of memory, allowing other processes to use it.
+ *
+ * @param ptr A pointer to the start of the memory that should be freed.
+ */
+void myfree(void* ptr);