diff --git a/src/database.c b/src/database.c index 7998804..57d8543 100644 --- a/src/database.c +++ b/src/database.c @@ -96,7 +96,7 @@ int imdb_close(imdb_t *db) return 0; } -int db_rd_rec(imdb_t *db, imdb_rec_t *rec) +int imdb_read_rec(imdb_t *db, imdb_rec_t *rec) { ssize_t bytes = 0; @@ -110,7 +110,7 @@ int db_rd_rec(imdb_t *db, imdb_rec_t *rec) return bytes / IMDB_REC_LEN; } -int db_wr_rec(imdb_t *db, imdb_rec_t *rec) +int imdb_write_rec(imdb_t *db, imdb_rec_t *rec) { ssize_t bytes = 0; @@ -124,7 +124,7 @@ int db_wr_rec(imdb_t *db, imdb_rec_t *rec) return bytes / IMDB_REC_LEN; } -int db_rd_blk(imdb_t *db, block_t *blk) +int imdb_read_blk(imdb_t *db, block_t *blk) { ssize_t bytes = 0; @@ -142,7 +142,7 @@ int db_rd_blk(imdb_t *db, block_t *blk) return blk->records; } -int db_rd_list(imdb_t *db, imdb_rec_t *list, size_t list_len) +int imdb_read_list(imdb_t *db, imdb_rec_t *list, size_t list_len) { imdb_rec_t *r = NULL; ssize_t bytes; @@ -163,7 +163,7 @@ int db_rd_list(imdb_t *db, imdb_rec_t *list, size_t list_len) return processed; } -int db_wr_list(imdb_t *db, imdb_rec_t *list, size_t list_len) +int imdb_write_list(imdb_t *db, imdb_rec_t *list, size_t list_len) { imdb_rec_t *r = NULL; ssize_t bytes; @@ -184,7 +184,7 @@ int db_wr_list(imdb_t *db, imdb_rec_t *list, size_t list_len) return processed; } -int db_search(imdb_t *db, imdb_rec_t *sample, float tresh, match_t **matches) +int imdb_search(imdb_t *db, imdb_rec_t *sample, float tresh, match_t **matches) { const int blk_size = 4096; uint64_t found = 0; @@ -201,7 +201,7 @@ int db_search(imdb_t *db, imdb_rec_t *sample, float tresh, match_t **matches) blk.start = 1; blk.records = blk_size; - if (db_rd_rec(db, sample) < 1) { + if (imdb_read_rec(db, sample) < 1) { db->errstr = "Can't read source sample"; return -1; } @@ -212,7 +212,7 @@ int db_search(imdb_t *db, imdb_rec_t *sample, float tresh, match_t **matches) } *matches = NULL; - while (db_rd_blk(db, &blk) > 0) { + while (imdb_read_blk(db, &blk) > 0) { p = blk.data; for (i = 0; i < blk.records; i++, p += IMDB_REC_LEN) { t = p + REC_OFF_RU; diff --git a/src/database.h b/src/database.h index 2cda218..07d7165 100644 --- a/src/database.h +++ b/src/database.h @@ -67,17 +67,17 @@ typedef struct { float diff; } match_t; -extern int imdb_open(imdb_t *db, const char *path); +extern int imdb_open (imdb_t *db, const char *path); extern int imdb_close(imdb_t *db); -extern int db_rd_rec(imdb_t *db, imdb_rec_t *rec); -extern int db_wr_rec(imdb_t *db, imdb_rec_t *rec); +extern int imdb_read_rec (imdb_t *db, imdb_rec_t *rec); +extern int imdb_write_rec(imdb_t *db, imdb_rec_t *rec); -extern int db_rd_blk(imdb_t *db, block_t *blk); -extern int db_wr_blk(imdb_t *db, block_t *blk); +extern int imdb_read_blk (imdb_t *db, block_t *blk); +extern int imdb_write_blk(imdb_t *db, block_t *blk); -extern int db_rd_list(imdb_t *db, imdb_rec_t *list, size_t list_len); -extern int db_wr_list(imdb_t *db, imdb_rec_t *list, size_t list_len); +extern int imdb_read_list (imdb_t *db, imdb_rec_t *list, size_t list_len); +extern int imdb_write_list(imdb_t *db, imdb_rec_t *list, size_t list_len); /** @returns: @@ -85,6 +85,6 @@ extern int db_wr_list(imdb_t *db, imdb_rec_t *list, size_t list_len); 0 if nothing found >0 if found some matches */ -extern int db_search(imdb_t *db, imdb_rec_t *sample, float tresh, match_t **matches); +extern int imdb_search(imdb_t *db, imdb_rec_t *sample, float tresh, match_t **matches); #endif diff --git a/src/util.c b/src/util.c index 1ab7034..5de6195 100644 --- a/src/util.c +++ b/src/util.c @@ -42,7 +42,7 @@ int search_similar(imdb_t *db, imdb_rec_t *sample, float tresh) int ret = 0, i = 0; match_t *matches = NULL; - ret = db_search(db, sample, tresh, &matches); + ret = imdb_search(db, sample, tresh, &matches); if (ret == -1) { printf("%s\n", db->errstr); exit(EXIT_FAILURE); @@ -75,7 +75,7 @@ int db_usage_map(imdb_t *db, unsigned short int cols) blk.start = 1; blk.records = blk_size; - while (db_rd_blk(db, &blk) > 0) { + while (imdb_read_blk(db, &blk) > 0) { p = blk.data; for (i = 0; i < blk.records; i++, p += IMDB_REC_LEN) { t = p + REC_OFF_RU; @@ -102,7 +102,7 @@ int rec_bitmap(imdb_t *db, imdb_rec_t *sample) assert(db != NULL); assert(sample != NULL); - if (db_rd_rec(db, sample) < 1) + if (imdb_read_rec(db, sample) < 1) return -1; if (!sample->data[0]) { @@ -139,7 +139,7 @@ int rec_diff(imdb_t *db, unsigned long a, unsigned long b, unsigned short int sh src.num = a; dst.num = b; - if (db_rd_rec(db, &src) < 1) + if (imdb_read_rec(db, &src) < 1) return -1; if (!src.data[0]) { @@ -147,7 +147,7 @@ int rec_diff(imdb_t *db, unsigned long a, unsigned long b, unsigned short int sh return 0; } - if (db_rd_rec(db, &dst) < 1) + if (imdb_read_rec(db, &dst) < 1) return -1; if (!src.data[0]) {