File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ #ifndef MEMORY_ALLOC_H_ZPNDLSE1
2+ #define MEMORY_ALLOC_H_ZPNDLSE1
3+
4+ #include <types.h>
5+
6+ /**
7+ * Allocate memory of given size and return its starting address.
8+ *
9+ * @param size_t size of the memory to allocate
10+ * @return void * address of the memory. NULL if allocation failed
11+ */
12+ void * malloc (size_t );
13+
14+ /**
15+ * Reallocate a piece of memory with the new size.
16+ *
17+ * @param void * address of memory to reallocate
18+ * @param size_t size of the new memory
19+ * @return void * address of the newly reallocated memory. NULL if
20+ * reallocation failed.
21+ */
22+ void * realloc (void * , size_t );
23+
24+ /**
25+ * Allocates memory for the given number of array elements of the given array
26+ * size. The memory is set to 0.
27+ *
28+ * @param size_t size of the array to allocate memory for
29+ * @param size_t size of each array element
30+ * @return void * address of the newly allocated memory. NULL if
31+ * allocation failed.
32+ */
33+ void * calloc (size_t , size_t );
34+
35+ /**
36+ * Free a piece of allocated memory.
37+ *
38+ * @param void * address of the allocated memory
39+ */
40+ void free (void * );
41+
42+ #endif /* end of include guard: MEMORY_ALLOC_H_ZPNDLSE1 */
You can’t perform that action at this time.
0 commit comments