From ff966a6b4d76040795ffd0c6314bf82333581103 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Mon, 8 Oct 2018 14:13:11 +0000 Subject: [PATCH] clang-format Fix a bunch of trivial formatting issues by running `clang-format`. Signed-off-by: Dan Cross --- src/strings.c | 166 +++++++++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/src/strings.c b/src/strings.c index ece3ee1..b6680af 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1,83 +1,83 @@ -#include "bbs.h" -#include -#include -#include - -extern struct bbs_config conf; - -char *undefined = "Undefined String"; -char **strings; -int string_count; - -void chomp(char *string) { - while (strlen(string) && (string[strlen(string)-1] == '\r' || string[strlen(string)-1] == '\n')) { - string[strlen(string)-1] = '\0'; - } -} - -char *parse_newlines(char *string) { - char *newstring = (char *)malloc(strlen(string) + 1); - int pos = 0; - int i; - for (i=0;i= string_count) { - return undefined; - } - - return strings[offset]; -} - -void load_strings() { - FILE *fptr; - char buffer[1024]; - - if (conf.string_file == NULL) { - fprintf(stderr, "Strings file can not be undefined!\n"); - exit(-1); - } - - fptr = fopen(conf.string_file, "r"); - if (!fptr) { - fprintf(stderr, "Unable to open strings file!\n"); - exit(-1); - } - - string_count = 0; - - fgets(buffer, 1024, fptr); - while (!feof(fptr)) { - chomp(buffer); - if (string_count == 0) { - strings = (char **)malloc(sizeof(char *)); - } else { - strings = (char **)realloc(strings, sizeof(char *) * (string_count + 1)); - } - strings[string_count] = parse_newlines(buffer); - string_count++; - fgets(buffer, 1024, fptr); - } - fclose(fptr); -} +#include "bbs.h" +#include +#include +#include + +extern struct bbs_config conf; + +char *undefined = "Undefined String"; +char **strings; +int string_count; + +void chomp(char *string) { + while (strlen(string) && (string[strlen(string)-1] == '\r' || string[strlen(string)-1] == '\n')) { + string[strlen(string)-1] = '\0'; + } +} + +char *parse_newlines(char *string) { + char *newstring = (char *)malloc(strlen(string) + 1); + int pos = 0; + int i; + for (i=0;i= string_count) { + return undefined; + } + + return strings[offset]; +} + +void load_strings() { + FILE *fptr; + char buffer[1024]; + + if (conf.string_file == NULL) { + fprintf(stderr, "Strings file can not be undefined!\n"); + exit(-1); + } + + fptr = fopen(conf.string_file, "r"); + if (!fptr) { + fprintf(stderr, "Unable to open strings file!\n"); + exit(-1); + } + + string_count = 0; + + fgets(buffer, 1024, fptr); + while (!feof(fptr)) { + chomp(buffer); + if (string_count == 0) { + strings = (char **)malloc(sizeof(char *)); + } else { + strings = (char **)realloc(strings, sizeof(char *) * (string_count + 1)); + } + strings[string_count] = parse_newlines(buffer); + string_count++; + fgets(buffer, 1024, fptr); + } + fclose(fptr); +}