commit 10129c83025214df7d9a9ef629835fba26410618
parent 288bf2ef84f67bb5e631fd239a7dda41a0d3773b
Author: solusipse <solus1ps3@gmail.com>
Date: Thu, 19 Oct 2017 22:18:57 +0200
parent 288bf2ef84f67bb5e631fd239a7dda41a0d3773b
Author: solusipse <solus1ps3@gmail.com>
Date: Thu, 19 Oct 2017 22:18:57 +0200
Simplified mechanism for null-terminating main buffer
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git 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);
: nply/fiche2