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 flags;
char path[PATH_MAX];
char error[256];
} 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;
if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) {
fprintf(stderr, "%s\n", db->error);
fprintf(stderr, "%s\n", imdb_error(ret));
return 1;
}

8
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;

Loading…
Cancel
Save