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/fdt.c b/src/fdt.c
index d20b82e..162b606 100644
--- a/src/fdt.c
+++ b/src/fdt.c
@@ -78,8 +78,8 @@
return false;
}
-static bool fdt_tokenizer_bytes(struct fdt_tokenizer *t,
- const char **res, size_t size)
+static bool fdt_tokenizer_bytes(struct fdt_tokenizer *t, const char **res,
+ size_t size)
{
const char *next = t->cur + size;
if (next > t->end)
@@ -197,7 +197,8 @@
const char *name;
const char *buf;
uint32_t size;
- while (fdt_next_property(t, &name, &buf, &size));
+ while (fdt_next_property(t, &name, &buf, &size))
+ ;
}
static bool fdt_skip_node(struct fdt_tokenizer *t)
@@ -320,9 +321,11 @@
depth++;
while (fdt_next_property(&t, &name, &buf, &size)) {
size_t i;
- dlog("%*sproperty: \"%s\" (", 2 * depth, "", name);
+ dlog("%*sproperty: \"%s\" (", 2 * depth, "",
+ name);
for (i = 0; i < size; i++)
- dlog("%s%02x", i == 0 ? "" : " ", buf[i]);
+ dlog("%s%02x", i == 0 ? "" : " ",
+ buf[i]);
dlog(")\n");
}
}
@@ -338,9 +341,12 @@
dlog("fdt: off_mem_rsvmap=%u\n", be32toh(hdr->off_mem_rsvmap));
{
- struct fdt_reserve_entry *e = (struct fdt_reserve_entry *)((size_t)hdr + be32toh(hdr->off_mem_rsvmap));
+ struct fdt_reserve_entry *e =
+ (struct fdt_reserve_entry
+ *)((size_t)hdr + be32toh(hdr->off_mem_rsvmap));
while (e->address || e->size) {
- dlog("Entry: %p (0x%x bytes)\n", be64toh(e->address), be64toh(e->size));
+ dlog("Entry: %p (0x%x bytes)\n", be64toh(e->address),
+ be64toh(e->size));
e++;
}
}
@@ -351,10 +357,14 @@
/* TODO: Clean this up. */
char *begin = (char *)hdr + be32toh(hdr->off_mem_rsvmap);
struct fdt_reserve_entry *e = (struct fdt_reserve_entry *)begin;
- hdr->totalsize = htobe32(be32toh(hdr->totalsize) + sizeof(struct fdt_reserve_entry));
- hdr->off_dt_struct = htobe32(be32toh(hdr->off_dt_struct) + sizeof(struct fdt_reserve_entry));
- hdr->off_dt_strings = htobe32(be32toh(hdr->off_dt_strings) + sizeof(struct fdt_reserve_entry));
- memmove(begin + sizeof(struct fdt_reserve_entry), begin, be32toh(hdr->totalsize) - be32toh(hdr->off_mem_rsvmap));
+ hdr->totalsize = htobe32(be32toh(hdr->totalsize) +
+ sizeof(struct fdt_reserve_entry));
+ hdr->off_dt_struct = htobe32(be32toh(hdr->off_dt_struct) +
+ sizeof(struct fdt_reserve_entry));
+ hdr->off_dt_strings = htobe32(be32toh(hdr->off_dt_strings) +
+ sizeof(struct fdt_reserve_entry));
+ memmove(begin + sizeof(struct fdt_reserve_entry), begin,
+ be32toh(hdr->totalsize) - be32toh(hdr->off_mem_rsvmap));
e->address = htobe64(addr);
e->size = htobe64(len);
}