summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--csv-test.c4
-rw-r--r--csv.c10
-rw-r--r--csv.h6
3 files changed, 10 insertions, 10 deletions
diff --git a/csv-test.c b/csv-test.c
index d14d6c2..eadcf53 100644
--- a/csv-test.c
+++ b/csv-test.c
@@ -61,9 +61,9 @@ test_exception_with_signal(FILE *f)
61} 61}
62 62
63static void 63static void
64my_error_handler(csv_error_t csv_error, void *env) 64my_error_handler(csv_err_t csv_err, void *env)
65{ 65{
66 fprintf(stderr, "my_error_handler: %s\n", csv_err_str(csv_error)); 66 fprintf(stderr, "my_error_handler: %s\n", csv_err_str(csv_err));
67 longjmp(*((jmp_buf *) env), 1); 67 longjmp(*((jmp_buf *) env), 1);
68} 68}
69 69
diff --git a/csv.c b/csv.c
index 9c3f895..e36e3ba 100644
--- a/csv.c
+++ b/csv.c
@@ -47,13 +47,13 @@ const csv_options_t csv_default_options = {
47/* === CSV-ERROR Interface === */ 47/* === CSV-ERROR Interface === */
48 48
49INLINE void 49INLINE void
50csv_fatal_error(csv_error_t csv_error, const csv_options_t * const csv_options) 50csv_fatal_error(csv_err_t csv_err, const csv_options_t * const csv_options)
51{ 51{
52 if ( csv_options->cb_error != NULL ) { 52 if ( csv_options->cb_error != NULL ) {
53 (*csv_options->cb_error)(csv_error, csv_options->cb_error_arg); 53 (*csv_options->cb_error)(csv_err, csv_options->cb_error_arg);
54 } 54 }
55 55
56 fprintf(stderr, "fatal error: %s\n", csv_err_str(csv_error)); 56 fprintf(stderr, "fatal error: %s\n", csv_err_str(csv_err));
57 abort(); 57 abort();
58} 58}
59 59
@@ -418,9 +418,9 @@ csv_read(csv_t *csv, FILE *in)
418} 418}
419 419
420const char * 420const char *
421csv_err_str(csv_error_t csv_error) 421csv_err_str(csv_err_t csv_err)
422{ 422{
423 switch ( csv_error ) { 423 switch ( csv_err ) {
424 case CSV_ERR_OK: return "no error"; 424 case CSV_ERR_OK: return "no error";
425 case CSV_ERR_OUT_OF_MEMORY: return "out of memory"; 425 case CSV_ERR_OUT_OF_MEMORY: return "out of memory";
426 case CSV_ERR_OUT_OF_RANGE: return "index out of range"; 426 case CSV_ERR_OUT_OF_RANGE: return "index out of range";
diff --git a/csv.h b/csv.h
index a8be413..9fcfa55 100644
--- a/csv.h
+++ b/csv.h
@@ -14,13 +14,13 @@ typedef enum {
14 CSV_ERR_OUT_OF_RANGE = -2, 14 CSV_ERR_OUT_OF_RANGE = -2,
15 CSV_ERR_IO_READ = -3, 15 CSV_ERR_IO_READ = -3,
16 CSV_ERR_IO_WRITE = -4 16 CSV_ERR_IO_WRITE = -4
17} csv_error_t; 17} csv_err_t;
18 18
19typedef struct { 19typedef struct {
20 char quote_symbol; 20 char quote_symbol;
21 char sep_symbol; 21 char sep_symbol;
22 22
23 void (*cb_error)(csv_error_t, void *); 23 void (*cb_error)(csv_err_t, void *);
24 void *cb_error_arg; 24 void *cb_error_arg;
25 25
26 void *(*cb_allocate)(size_t, size_t, void *); 26 void *(*cb_allocate)(size_t, size_t, void *);
@@ -53,7 +53,7 @@ void csv_cleanup(csv_t *csv);
53int csv_nfields(csv_t *csv); 53int csv_nfields(csv_t *csv);
54const char * csv_field(csv_t *csv, int idx); 54const char * csv_field(csv_t *csv, int idx);
55int csv_read(csv_t *csv, FILE *in); 55int csv_read(csv_t *csv, FILE *in);
56const char * csv_err_str(csv_error_t csv_error); 56const char * csv_err_str(csv_err_t csv_err);
57void csv_write(FILE *out, int n, const char *fields[], const csv_options_t * const csv_options); 57void csv_write(FILE *out, int n, const char *fields[], const csv_options_t * const csv_options);
58 58
59#ifdef __cplusplus 59#ifdef __cplusplus