Format headers as well.

indent(1) does a weird thing with prototype functions, but it's good
enough for me, as long as it's consistent.
This commit is contained in:
Jordan Bancino 2022-07-25 15:25:06 -04:00
parent aabb2a0203
commit 3437c5db2c
9 changed files with 94 additions and 86 deletions

View file

@ -74,7 +74,7 @@ recipe_clean() {
} }
recipe_format() { recipe_format() {
find src -name '*.c' | while IFS= read -r src; do find src -name '*.c' -or -name '*.h' | while IFS= read -r src; do
echo "indent $src" echo "indent $src"
indent -bad -bap -bbb -nbc -bl -c36 -cd36 -ncdb -nce \ indent -bad -bap -bbb -nbc -bl -c36 -cd36 -ncdb -nce \
-ci8 -cli1 -d0 -di1 -ndj -ei -fc1 -i4 -ip -l72 \ -ci8 -cli1 -d0 -di1 -ndj -ei -fc1 -i4 -ip -l72 \

View file

@ -22,4 +22,3 @@ extern int
Base64Pad(char **base64Ptr, size_t length); Base64Pad(char **base64Ptr, size_t length);
#endif #endif

View file

@ -1,7 +1,8 @@
#ifndef TELODENDRIA_HTTP_H #ifndef TELODENDRIA_HTTP_H
#define TELODENDRIA_HTTP_H #define TELODENDRIA_HTTP_H
typedef enum HttpRequestMethod { typedef enum HttpRequestMethod
{
HTTP_GET, HTTP_GET,
HTTP_HEAD, HTTP_HEAD,
HTTP_POST, HTTP_POST,
@ -13,7 +14,8 @@ typedef enum HttpRequestMethod {
HTTP_PATCH HTTP_PATCH
} HttpRequestMethod; } HttpRequestMethod;
typedef enum HttpStatus { typedef enum HttpStatus
{
/* Informational responses */ /* Informational responses */
HTTP_CONTINUE = 100, HTTP_CONTINUE = 100,
HTTP_SWITCHING_PROTOCOLS = 101, HTTP_SWITCHING_PROTOCOLS = 101,
@ -74,11 +76,13 @@ typedef enum HttpStatus {
HTTP_NETWORK_AUTH_REQUIRED = 511 HTTP_NETWORK_AUTH_REQUIRED = 511
} HttpStatus; } HttpStatus;
struct HttpRequest { struct HttpRequest
{
HttpRequestMethod method; HttpRequestMethod method;
}; };
struct HttpResponse { struct HttpResponse
{
HttpStatus status; HttpStatus status;
}; };

View file

@ -4,7 +4,8 @@
#include <HashMap.h> #include <HashMap.h>
#include <Array.h> #include <Array.h>
typedef enum JsonType { typedef enum JsonType
{
JSON_OBJECT, JSON_OBJECT,
JSON_ARRAY, JSON_ARRAY,
JSON_STRING, JSON_STRING,
@ -14,9 +15,11 @@ typedef enum JsonType {
JSON_NULL JSON_NULL
} JsonType; } JsonType;
typedef struct JsonValue { typedef struct JsonValue
{
JsonType type; JsonType type;
union as { union as
{
HashMap *object; HashMap *object;
Array *array; Array *array;
char *string; char *string;

View file

@ -4,7 +4,8 @@
#include <stdio.h> #include <stdio.h>
#include <stddef.h> #include <stddef.h>
typedef enum LogLevel { typedef enum LogLevel
{
LOG_ERROR, LOG_ERROR,
LOG_WARNING, LOG_WARNING,
LOG_TASK, LOG_TASK,
@ -12,7 +13,8 @@ typedef enum LogLevel {
LOG_DEBUG LOG_DEBUG
} LogLevel; } LogLevel;
typedef enum LogFlag { typedef enum LogFlag
{
LOG_FLAG_COLOR = (1 << 0) LOG_FLAG_COLOR = (1 << 0)
} LogFlag; } LogFlag;