From 14705844d7b7553965f20c4553b678869a9eefbc Mon Sep 17 00:00:00 2001 From: wildjan Date: Mon, 16 Dec 2024 10:41:51 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Buffer=20reset=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index 300b1a1..c05c570 100644 --- a/src/db.c +++ b/src/db.c @@ -63,8 +63,7 @@ llist *write_csv_to_llist(const char *filename) { int count = 0; // task counter fgets(line, sizeof(line), file); // read and ignore file head - while (fgets(line, sizeof(line), file)) { - memset(line, 0, sizeof(line)); + while (fgets(line, sizeof(line), file)); count++; // remove newline sign line[strcspn(line, "\n")] = '\0'; From 5f65a91ffbe85043e1069da6c4332aab089e751f Mon Sep 17 00:00:00 2001 From: wildjan Date: Mon, 16 Dec 2024 10:42:46 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Buffer=20reset=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index c05c570..f5ef88f 100644 --- a/src/db.c +++ b/src/db.c @@ -98,6 +98,6 @@ llist *write_csv_to_llist(const char *filename) { } } fclose(file); - } return list; // null on error -} + } + From 8d6d6b2870fed819a7b2ee1369579db109b288c2 Mon Sep 17 00:00:00 2001 From: wildjan Date: Mon, 16 Dec 2024 10:45:45 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Buffer=20reset=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db.c b/src/db.c index f5ef88f..a2c552e 100644 --- a/src/db.c +++ b/src/db.c @@ -63,7 +63,7 @@ llist *write_csv_to_llist(const char *filename) { int count = 0; // task counter fgets(line, sizeof(line), file); // read and ignore file head - while (fgets(line, sizeof(line), file)); + while (fgets(line, sizeof(line), file)){ count++; // remove newline sign line[strcspn(line, "\n")] = '\0'; @@ -98,6 +98,7 @@ llist *write_csv_to_llist(const char *filename) { } } fclose(file); - return list; // null on error } + return list; // null on error +}