Browse Source

* rename functions : db_{open,close} -> imdb_{open,close}

master
Alex 'AdUser' Z 10 years ago
parent
commit
56193e4dec
  1. 4
      src/database.c
  2. 4
      src/database.h
  3. 4
      src/util.c
  4. 4
      tests/database.c

4
src/database.c

@ -44,7 +44,7 @@
const char *imdb_hdr_fmt = "IMDB v%02u, CAPS: %s;"; const char *imdb_hdr_fmt = "IMDB v%02u, CAPS: %s;";
int db_open(imdb_t *db, const char *path) int imdb_open(imdb_t *db, const char *path)
{ {
int init = 0; int init = 0;
ssize_t bytes = 0; ssize_t bytes = 0;
@ -82,7 +82,7 @@ int db_open(imdb_t *db, const char *path)
return 0; return 0;
} }
int db_close(imdb_t *db) int imdb_close(imdb_t *db)
{ {
assert(db != NULL); assert(db != NULL);

4
src/database.h

@ -67,8 +67,8 @@ typedef struct {
float diff; float diff;
} match_t; } match_t;
extern int db_open(imdb_t *db, const char *path); extern int imdb_open(imdb_t *db, const char *path);
extern int db_close(imdb_t *db); extern int imdb_close(imdb_t *db);
extern int db_rd_rec(imdb_t *db, imdb_rec_t *rec); 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 db_wr_rec(imdb_t *db, imdb_rec_t *rec);

4
src/util.c

@ -238,7 +238,7 @@ int main(int argc, char **argv)
if (mode == diff && (a <= 0 || b <= 0)) if (mode == diff && (a <= 0 || b <= 0))
usage(EXIT_FAILURE); usage(EXIT_FAILURE);
if (db_open(&db, db_path) == -1) { if (imdb_open(&db, db_path) == -1) {
printf("%s\n", db.errstr); printf("%s\n", db.errstr);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -255,7 +255,7 @@ int main(int argc, char **argv)
if (mode == diff) if (mode == diff)
rec_diff(&db, a, b, map); rec_diff(&db, a, b, map);
db_close(&db); imdb_close(&db);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }

4
tests/database.c

@ -9,7 +9,7 @@ int main(int argc, char **argv)
char *path = "test.db"; char *path = "test.db";
unlink(path); unlink(path);
assert(db_open(&db, path) == 1); assert(imdb_open(&db, path) == 1);
rec[0].num = 1; rec[0].num = 1;
assert(db_rd_rec(&db, rec) == 0); assert(db_rd_rec(&db, rec) == 0);
@ -30,7 +30,7 @@ int main(int argc, char **argv)
rec[1].num = 3; rec[1].num = 3;
assert(db_rd_list(&db, rec, 2) == 1); assert(db_rd_list(&db, rec, 2) == 1);
assert(db_close(&db) == 0); assert(imdb_close(&db) == 0);
return 0; return 0;
} }

Loading…
Cancel
Save