From 68dbe795f4facc7882392fe1cce41f124b641a1b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 4 Mar 2021 00:30:15 -0300 Subject: clang-format --- src/remembering.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/remembering.c b/src/remembering.c index 5e614db..c60b03a 100644 --- a/src/remembering.c +++ b/src/remembering.c @@ -2,13 +2,13 @@ #define _POSIX_C_SOURCE 200809L #endif +#include +#include #include #include #include -#include #include -#include -#include +#include #ifdef TEST #include @@ -191,7 +191,8 @@ static struct Rankings *rankings_new() { } #ifdef FALLIBLE -static struct Rankings *fallible_rankings_new(const char *const filename, int lineno) { +static struct Rankings *fallible_rankings_new(const char *const filename, + int lineno) { if (fallible_should_fail(filename, lineno)) { return NULL; } @@ -234,14 +235,16 @@ static int rankings_insert(struct Rankings *r, char *value, int rank) { } #ifdef FALLIBLE -static int fallible_rankings_insert(struct Rankings *r, char *value, int rank, const char *const filename, int lineno) { +static int fallible_rankings_insert(struct Rankings *r, char *value, int rank, + const char *const filename, int lineno) { if (fallible_should_fail(filename, lineno)) { return -1; } return rankings_insert(r, value, rank); } -#define rankings_insert(r, value, rank) fallible_rankings_insert(r, value, rank, __FILE__, __LINE__) +#define rankings_insert(r, value, rank) \ + fallible_rankings_insert(r, value, rank, __FILE__, __LINE__) #endif #ifdef TEST @@ -286,7 +289,8 @@ static void rankings_test() { static const char RANKING_DELIMITER = ':'; -int parse_ranked_line(FILE *stream, const char *entry, char **value, int *rank) { +int parse_ranked_line(FILE *stream, const char *entry, char **value, + int *rank) { char *value_substr = strchr(entry, RANKING_DELIMITER); if (value_substr == NULL) { fprintf(stream, "WARN: Missing delimiter ('%c') in line: %s\n", @@ -308,14 +312,17 @@ int parse_ranked_line(FILE *stream, const char *entry, char **value, int *rank) } #ifdef FALLIBLE -int fallible_parse_ranked_line(FILE *stream, const char *entry, char **value, int *rank, const char *const filename, int lineno) { +int fallible_parse_ranked_line(FILE *stream, const char *entry, char **value, + int *rank, const char *const filename, + int lineno) { if (fallible_should_fail(filename, lineno)) { return -1; } return parse_ranked_line(stream, entry, value, rank); } -#define parse_ranked_line(stream, entry, value, rank) fallible_parse_ranked_line(stream, entry, value, rank, __FILE__, __LINE__) +#define parse_ranked_line(stream, entry, value, rank) \ + fallible_parse_ranked_line(stream, entry, value, rank, __FILE__, __LINE__) #endif #ifdef TEST @@ -386,13 +393,15 @@ void parse_ranked_line_test() { assert(rank == 0); free(value); - ret = parse_ranked_line(stderr, "0:command with : in the middle", &value, &rank); + ret = parse_ranked_line(stderr, "0:command with : in the middle", &value, + &rank); assert(ret == 0); assert(strcmp(value, "command with : in the middle") == 0); assert(rank == 0); free(value); - ret = parse_ranked_line(stderr, "0:::command:with:multiple:::in:the:middle:", &value, &rank); + ret = parse_ranked_line( + stderr, "0:::command:with:multiple:::in:the:middle:", &value, &rank); assert(ret == 0); assert(strcmp(value, "::command:with:multiple:::in:the:middle:") == 0); assert(rank == 0); @@ -469,7 +478,8 @@ int get_stdin(struct GetlineParams *s_params, struct GetlineParams *p_params, char *value; int rank; int ret; - if ((ret = parse_ranked_line(stderr, p_params->line, &value, &rank)) == -1) { + if ((ret = parse_ranked_line(stderr, p_params->line, &value, &rank)) == + -1) { return ret; } if ((ret = rankings_insert(p_rankings, value, rank)) == -1) { @@ -594,7 +604,6 @@ int main(int argc, char *argv[]) { expand_profile_name("oijoI"); } - err: return ret; } -- cgit v1.2.3