From 10129c83025214df7d9a9ef629835fba26410618 Mon Sep 17 00:00:00 2001 From: solusipse Date: Thu, 19 Oct 2017 22:18:57 +0200 Subject: [PATCH] Simplified mechanism for null-terminating main buffer --- fiche.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fiche.c b/fiche.c index be85073..c0bbe8d 100644 --- a/fiche.c +++ b/fiche.c @@ -761,12 +761,7 @@ static int save_to_file(const Fiche_Settings *s, uint8_t *data, char *slug) { } // Null-terminate buffer if not null terminated already - for (int i = 0; i < s->buffer_len; i++) { - if (data[i] == 0) { - break; - } - data[s->buffer_len - 1] = 0; - } + data[s->buffer_len - 1] = 0; if ( fprintf(f, "%s", data) < 0 ) { fclose(f);