From 0fdd03cab6f96d62f2ae7170ef929e5ee116bfb6 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 28 Dec 2016 17:47:00 +1000 Subject: [PATCH] * use imdb_error * drop imdb_db_t->error --- src/database.h | 1 - src/imdb-query.c | 2 +- src/imdb-write.c | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/database.h b/src/database.h index c5eaa51..808e9c3 100644 --- a/src/database.h +++ b/src/database.h @@ -26,7 +26,6 @@ typedef struct { int fd; int flags; char path[PATH_MAX]; - char error[256]; } imdb_db_t; /** diff --git a/src/imdb-query.c b/src/imdb-query.c index 8717e68..946d931 100644 --- a/src/imdb-query.c +++ b/src/imdb-query.c @@ -54,7 +54,7 @@ int search_similar(imdb_db_t *db, uint64_t number, float maxdiff) sample.num = number; if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) { - fprintf(stderr, "%s\n", db->error); + fprintf(stderr, "%s\n", imdb_error(ret)); return 1; } diff --git a/src/imdb-write.c b/src/imdb-write.c index 9cfb911..99c03b5 100644 --- a/src/imdb-write.c +++ b/src/imdb-write.c @@ -86,14 +86,14 @@ int main(int argc, char **argv) fprintf(stderr, "sampler failure\n"); exit(EXIT_FAILURE); } - if (imdb_write_rec(db, &rec) < 1) { - fprintf(stderr, "%s\n", db->error); + if ((err = imdb_write_rec(db, &rec)) < 1) { + fprintf(stderr, "%s\n", imdb_error(err)); exit(EXIT_FAILURE); } break; case del : - if (imdb_write_rec(db, &rec) < 1) { - fprintf(stderr, "%s\n", db->error); + if ((err = imdb_write_rec(db, &rec)) < 1) { + fprintf(stderr, "%s\n", imdb_error(err)); exit(EXIT_FAILURE); } break;