aboutsummaryrefslogtreecommitdiffstats
path: root/src/word.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/word.c')
-rw-r--r--src/word.c13
1 files changed, 6 insertions, 7 deletions
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;
}
-