From 80d2ed51804d282bbdd4544c1e0b7e392080e06e Mon Sep 17 00:00:00 2001 From: Joshua Vega Date: Sat, 24 Jan 2026 12:48:05 -0500 Subject: [PATCH] run clang-format --- .clang-format | 12 +++++++++++- format.sh | 2 +- main.c | 17 ++++++++--------- yaml.h | 16 ++++++++-------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.clang-format b/.clang-format index 534401f..44280df 100644 --- a/.clang-format +++ b/.clang-format @@ -1,2 +1,12 @@ --- -BasedOnStyle: WebKit +BasedOnStyle: LLVM +IndentWidth: 4 +ColumnLimit: 88 + +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: WithoutElse + +BinPackParameters: OnePerLine + +AlignConsecutiveMacros: Consecutive +AlignEscapedNewlines: LeftWithLastLine diff --git a/format.sh b/format.sh index 599768b..809ab0e 100755 --- a/format.sh +++ b/format.sh @@ -1,3 +1,3 @@ #!/bin/bash -find . -regex '.*\.\(c\|h\)' -exec clang-format -i --sort-includes {} \; +find . -regex '.*\.\(c\|h\)' -not -path "./CMakeFiles/*" -exec clang-format -i --sort-includes {} \; diff --git a/main.c b/main.c index 2295c86..27ea232 100644 --- a/main.c +++ b/main.c @@ -28,11 +28,10 @@ Config *config = NULL; -int parseArguments(int, char**); +int parseArguments(int, char **); void printHelp(void); -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { if (parseArguments(argc, argv) != 0) { printHelp(); return 0; @@ -41,14 +40,13 @@ int main(int argc, char** argv) return 0; } -int parseArguments(int argc, char** argv) -{ +int parseArguments(int argc, char **argv) { char configPath[1024]; size_t configPathLength = 0; bool expectConfigPath = false; for (int argIndex = 1; argIndex < argc; argIndex++) { - const char* arg = argv[argIndex]; + const char *arg = argv[argIndex]; if (expectConfigPath) { size_t length = strlen(arg); @@ -65,7 +63,9 @@ int parseArguments(int argc, char** argv) continue; } - if (!expectConfigPath && (strncmp(arg, ARG_L_CONFIG_PATH, ARG_LEN_L_CONFIG_PATH) || strncmp(arg, ARG_S_CONFIG_PATH, ARG_LEN_S_CONFIG_PATH))) { + if (!expectConfigPath && + (strncmp(arg, ARG_L_CONFIG_PATH, ARG_LEN_L_CONFIG_PATH) || + strncmp(arg, ARG_S_CONFIG_PATH, ARG_LEN_S_CONFIG_PATH))) { printf("Encountered config path argument.\n"); expectConfigPath = true; } else { @@ -80,7 +80,6 @@ int parseArguments(int argc, char** argv) return 0; } -void printHelp(void) -{ +void printHelp(void) { /* TODO */ } diff --git a/yaml.h b/yaml.h index 76a75fc..d50a8c3 100644 --- a/yaml.h +++ b/yaml.h @@ -4,13 +4,13 @@ #include typedef enum { - YAML_TYPE_STRING, /**< A value that represents a string. */ - YAML_TYPE_NUMBER, /**< A value that represents a number. */ - YAML_TYPE_OBJECT, /**< A value that represents an object. */ - YAML_TYPE_ARRAY, /**< A value that represents an array. */ - YAML_TYPE_TRUE, /**< A value that represents true. */ - YAML_TYPE_FALSE, /**< A value that represents false. */ - YAML_TYPE_NULL, /**< A value that represents null. */ + YAML_TYPE_STRING, /**< A value that represents a string. */ + YAML_TYPE_NUMBER, /**< A value that represents a number. */ + YAML_TYPE_OBJECT, /**< A value that represents an object. */ + YAML_TYPE_ARRAY, /**< A value that represents an array. */ + YAML_TYPE_TRUE, /**< A value that represents true. */ + YAML_TYPE_FALSE, /**< A value that represents false. */ + YAML_TYPE_NULL, /**< A value that represents null. */ } yaml_type_t; typedef struct { @@ -42,7 +42,7 @@ typedef struct { typedef struct yaml_array_element_s { yaml_value_t *value; - + struct yaml_array_element_s *next; } yaml_array_element_t;