style: clang-format on all files

This commit is contained in:
0x35c 2024-09-18 22:30:11 +02:00
parent 083468240d
commit 9b3a6cb5a4
15 changed files with 104 additions and 111 deletions

9
.clang-format Normal file
View File

@ -0,0 +1,9 @@
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: AlignWithSpaces
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: Never
AllowShortFunctionsOnASingleLine: Empty
IndentCaseLabels: false
ColumnLimit: 80
AlignConsecutiveMacros: true

View File

@ -14,10 +14,7 @@
#define REGISTER_A 0x0A
#define REGISTER_B 0x0B
enum {
CMOS_ADDRESS = 0x70,
CMOS_DATA = 0x71
};
enum { CMOS_ADDRESS = 0x70, CMOS_DATA = 0x71 };
struct rtc_date {
uint8_t second;

View File

@ -8,6 +8,7 @@ int memcmp(const void *s1, const void *s2, size_t n)
if (n == 0)
return 0;
for (i = 0; str1[i] == str2[i] && i < n - 1; i++);
for (i = 0; str1[i] == str2[i] && i < n - 1; i++)
;
return str1[i] - str2[i];
}

View File

@ -4,8 +4,7 @@ char *strchr(const char *str, int c)
{
char *start = (char *)str;
while (*start)
{
while (*start) {
if (*start == c)
return start;
start++;

View File

@ -8,8 +8,7 @@ char *strstr(const char *haystack, const char *needle)
size_t len;
len = strlen(needle);
while (*start != '\0')
{
while (*start != '\0') {
if (strncmp(start, needle, len) == 0)
return start;
start++;

View File

@ -1,30 +1,18 @@
#include "kprintf.h"
#include "rtc.h"
void date()
void date(void)
{
static const char *months[12] = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December" };
static const char * week_days[] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
static const char *months[12] = {"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"};
static const char *week_days[] = {"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday",
"Saturday"};
struct rtc_date date = get_date();
kprintf(0, "%s. %d %s. %d %d:%d:%d\n", week_days[date.index_of_the_day], date.day, months[date.month], date.year, date.hour, date.minute, date.second);
kprintf(0, "%s. %d %s. %d %d:%d:%d\n", week_days[date.index_of_the_day],
date.day, months[date.month], date.year, date.hour, date.minute,
date.second);
}