run clang-format

This commit is contained in:
Joshua Vega 2026-01-24 12:48:05 -05:00
parent 71385a1fd5
commit 80d2ed5180
Signed by: jsvcycling
GPG key ID: E3DD60C9AC7DEF79
4 changed files with 28 additions and 19 deletions

View file

@ -1,2 +1,12 @@
---
BasedOnStyle: WebKit
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 88
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: WithoutElse
BinPackParameters: OnePerLine
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: LeftWithLastLine

View file

@ -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 {} \;

17
main.c
View file

@ -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 */
}

16
yaml.h
View file

@ -4,13 +4,13 @@
#include <stdlib.h>
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;