From 7cf4aa222ab5cbda4bf8a6ffc968a85304cc8333 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Thu, 2 Jul 2020 09:12:20 +0200 Subject: csv-read() sollte bei Dateiende EOF liefern, statt -1. Damit wird der Clientcode lesbarer und verständlicher. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- csv-perf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'csv-perf.c') diff --git a/csv-perf.c b/csv-perf.c index efd2155..ddb4808 100644 --- a/csv-perf.c +++ b/csv-perf.c @@ -13,7 +13,7 @@ test(FILE *f) int line = 0; csv_t csv = { 0 }; - while ( csv_read(&csv, f) != -1 ) { + while ( csv_read(&csv, f) != EOF ) { ++line; } @@ -27,7 +27,7 @@ test_exception(FILE *f) csv_t csv[1]; csv_init(csv); - for ( int n; (n = csv_read(csv, f)) != -1; ) { + for ( int n; (n = csv_read(csv, f)) != EOF; ) { if (++line == 500000) csv_field(csv, -1); } @@ -52,7 +52,7 @@ test_exception_with_signal(FILE *f) csv_t csv[1]; csv_init(csv); - for ( int n; (n = csv_read(csv, f)) != -1; ) { + for ( int n; (n = csv_read(csv, f)) != EOF; ) { if (++line == 500000) csv_field(csv, -1); } @@ -88,7 +88,7 @@ test_exception_longjmp(FILE *f) if ( setjmp(env) == 0 ) { int line = 0; - for ( int n; (n = csv_read(csv, f)) != -1; ) { + for ( int n; (n = csv_read(csv, f)) != EOF; ) { // process data... if (++line == 500000) csv_field(csv, -1); } -- cgit v1.3