Browse Source

* use imdb_error

* drop imdb_db_t->error
master
Alex 'AdUser' Z 8 years ago
parent
commit
0fdd03cab6
  1. 1
      src/database.h
  2. 2
      src/imdb-query.c
  3. 8
      src/imdb-write.c

1
src/database.h

@ -26,7 +26,6 @@ typedef struct {
int fd; int fd;
int flags; int flags;
char path[PATH_MAX]; char path[PATH_MAX];
char error[256];
} imdb_db_t; } imdb_db_t;
/** /**

2
src/imdb-query.c

@ -54,7 +54,7 @@ int search_similar(imdb_db_t *db, uint64_t number, float maxdiff)
sample.num = number; sample.num = number;
if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) { if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) {
fprintf(stderr, "%s\n", db->error); fprintf(stderr, "%s\n", imdb_error(ret));
return 1; return 1;
} }

8
src/imdb-write.c

@ -86,14 +86,14 @@ int main(int argc, char **argv)
fprintf(stderr, "sampler failure\n"); fprintf(stderr, "sampler failure\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (imdb_write_rec(db, &rec) < 1) { if ((err = imdb_write_rec(db, &rec)) < 1) {
fprintf(stderr, "%s\n", db->error); fprintf(stderr, "%s\n", imdb_error(err));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
break; break;
case del : case del :
if (imdb_write_rec(db, &rec) < 1) { if ((err = imdb_write_rec(db, &rec)) < 1) {
fprintf(stderr, "%s\n", db->error); fprintf(stderr, "%s\n", imdb_error(err));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
break; break;

Loading…
Cancel
Save