From a8ef1c4d3a4397845e54dec661cbd093451b8ad9 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 12 Jul 2025 12:38:06 -0400 Subject: Remove unnecessary memset for word buffer --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 57898f4..ee5cdd7 100644 --- a/src/main.c +++ b/src/main.c @@ -48,14 +48,14 @@ int justify(size_t linebuffer_capacity, FILE *in, FILE *out) { int read_word_result; LineBuffer *lb = linebuffer_create(linebuffer_capacity); - while ((read_word_result = read_word(in, word, MAX_WORD_LENGTH + 1)) == - READ_WORD_SUCCESS) { + read_word_result = read_word(in, word, MAX_WORD_LENGTH + 1); + while (read_word_result == READ_WORD_SUCCESS) { if (!linebuffer_append_word(lb, word)) { linebuffer_write_justified(lb, out); linebuffer_clear(lb); linebuffer_append_word(lb, word); } - memset(word, 0, MAX_WORD_LENGTH + 1); + read_word_result = read_word(in, word, MAX_WORD_LENGTH + 1); } if (read_word_result == READ_WORD_ERR_READ) { fprintf(stderr, "Error reading word\n"); -- cgit v1.2.3