From e61179fe37a64e5d9ad8d9cd03f66302bbb79a35 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Thu, 4 Jul 2024 10:39:16 -0400 Subject: Format files --- src/word.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/word.c') diff --git a/src/word.c b/src/word.c index f10a648..4b2249b 100644 --- a/src/word.c +++ b/src/word.c @@ -7,13 +7,13 @@ int read_word(FILE *fp, char *word, size_t length) { size_t position = 0; while ((ch = read_char(fp)) == ' ') - ; + ; while (ch != ' ' && ch != EOF) { - if (position < length) { - word[position++] = ch; - } - ch = read_char(fp); + if (position < length) { + word[position++] = ch; + } + ch = read_char(fp); } word[position] = '\0'; return ch; @@ -22,8 +22,7 @@ int read_word(FILE *fp, char *word, size_t length) { static inline int read_char(FILE *fp) { int ch = getc(fp); if (ch == '\n' || ch == '\t') { - return ' '; + return ' '; } return ch; } - -- cgit v1.2.3