Introduce clang-format
An automated and opinionated style for code. We can decide to change the
style and have the source updated by the clang-format tool by running:
make format
I've based the style on the Google style with exceptions to better
match
the current source style.
Change-Id: I43f85c7d4ce02ca999805558b25fcab2e43859c6
diff --git a/src/mm.c b/src/mm.c
index 4a72d56..8bfd6f4 100644
--- a/src/mm.c
+++ b/src/mm.c
@@ -6,9 +6,14 @@
#include "alloc.h"
#include "dlog.h"
+/* Keep macro alignment */
+/* clang-format off */
+
#define MAP_FLAG_SYNC 0x01
#define MAP_FLAG_COMMIT 0x02
+/* clang-format on */
+
/**
* Calculates the size of the address space represented by a page table entry at
* the given level.
@@ -58,7 +63,7 @@
/* Allocate a new table. */
ntable = (sync_alloc ? halloc_aligned : halloc_aligned_nosync)(
- PAGE_SIZE, PAGE_SIZE);
+ PAGE_SIZE, PAGE_SIZE);
if (!ntable) {
dlog("Failed to allocate memory for page table\n");
return NULL;
@@ -142,12 +147,12 @@
mm_free_page_pte(pte, level, sync);
}
} else {
- pte_t *nt = mm_populate_table_pte(table + i, level,
- sync);
+ pte_t *nt =
+ mm_populate_table_pte(table + i, level, sync);
if (!nt)
return false;
- if (!mm_map_level(va, va_end, pa, attrs, nt, level-1,
+ if (!mm_map_level(va, va_end, pa, attrs, nt, level - 1,
flags))
return false;
}