aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 17:57:53 -0500
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 17:57:53 -0500
commitf88198cb987ab006f3406698fec410ff1de05534 (patch)
tree336c7a1ca34615fda653e94a6526763214a4e552 /src
parent33be32d518e17c8f8971fa7c1fe09adcccd82a67 (diff)
downloadliballoc-f88198cb987ab006f3406698fec410ff1de05534.tar.gz
Ran clangtidy
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c8
-rw-r--r--src/free_list.c18
2 files changed, 12 insertions, 14 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3f805db..39cbf88 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5,14 +5,14 @@
* CISC 301 -- Operating Systems, Project 3
*
* Copyright (C) 2025 Douglas B. Rumbaugh <dbrumbaugh@harrisburgu.edu>
- *
+ *
* Distributed under the Modified BSD License
*
*/
#include "alloc.h"
+#include "alloc_header.h"
#include "constants.h"
#include "free_list.h"
-#include "alloc_header.h"
static void *heap_start = 0;
static void *heap_end = 0;
@@ -84,6 +84,4 @@ void release(void *ptr) {
fl_coalesce_nodes(free_list);
}
-free_nd *free_list_head() {
- return free_list;
-}
+free_nd *free_list_head() { return free_list; }
diff --git a/src/free_list.c b/src/free_list.c
index 6c0ff35..0ecb23f 100644
--- a/src/free_list.c
+++ b/src/free_list.c
@@ -25,8 +25,8 @@ void *fl_split_node(free_nd **free_list, free_nd *split_nd, size_t size) {
ssize_t extra_space = split_nd->size - size - sizeof(header);
if (extra_space >= SPLIT_THRESHOLD) {
- free_nd *new_nd = (free_nd*)((char*) (split_nd) + size + sizeof(header));
- new_nd->next = split_nd ->next;
+ free_nd *new_nd = (free_nd *)((char *)(split_nd) + size + sizeof(header));
+ new_nd->next = split_nd->next;
split_nd->next = new_nd;
new_nd->size = extra_space - sizeof(header);
@@ -35,7 +35,7 @@ void *fl_split_node(free_nd **free_list, free_nd *split_nd, size_t size) {
new_hdr->magic_number = MAGIC_NUMBER;
new_hdr->size = extra_space - sizeof(header);
- header *old_hdr = (header *)((char *)split_nd- sizeof(header));
+ header *old_hdr = (header *)((char *)split_nd - sizeof(header));
old_hdr->size = size;
}
@@ -45,9 +45,9 @@ void *fl_split_node(free_nd **free_list, free_nd *split_nd, size_t size) {
for (free_nd *nd = *free_list; nd; nd = nd->next) {
if (nd->next == split_nd) {
- /*
- * split_nd is not null, so we know that nd->next is
- * also not null here
+ /*
+ * split_nd is not null, so we know that nd->next is
+ * also not null here
*/
nd->next = nd->next->next;
}
@@ -77,8 +77,8 @@ void fl_add_node(free_nd **free_list, void *ptr) {
}
}
- new_nd->next = *insert_point;
- new_nd->size = ((header*)(ptr - sizeof(header)))->size;
+ new_nd->next = *insert_point;
+ new_nd->size = ((header *)(ptr - sizeof(header)))->size;
*insert_point = new_nd;
- }
+}