diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-01 23:46:26 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-01 23:46:26 +0000 |
commit | b5a2d4f1d9120dceef2ae2f4a15c51f742aa5b13 (patch) | |
tree | a1f003c54eb5f0e5df3ab4f78085807b27a85c70 /mandocdb.c | |
parent | fd5c6254f7f0752890880b0db1cd2ee064978980 (diff) | |
download | mandoc-b5a2d4f1d9120dceef2ae2f4a15c51f742aa5b13.tar.gz |
In apropos_db.c, move all btree reading (and safety checks) into the
btree_read() function. Also, add a forgotten free() for the type of
grokked record.
Then in both mandocdb.c and apropos_db.c, make the "rec" field of the
btree by in network-order.
Diffstat (limited to 'mandocdb.c')
-rw-r--r-- | mandocdb.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -33,6 +33,8 @@ #include <string.h> #include <unistd.h> +#include <arpa/inet.h> + #ifdef __linux__ # include <db_185.h> #else @@ -626,15 +628,13 @@ index_merge(const struct of *of, struct mparse *mp, * into the database. */ - vbuf.rec = rec; + vbuf.rec = htonl(rec); seq = R_FIRST; while (0 == (ch = (*hash->seq)(hash, &key, &val, seq))) { seq = R_NEXT; - vbuf.mask = *(uint64_t *)val.data; val.size = sizeof(struct db_val); val.data = &vbuf; - dbt_put(db, dbf, &key, &val); } if (ch < 0) { @@ -732,7 +732,7 @@ index_prune(const struct of *ofile, DB *db, const char *dbf, break; vbuf = val.data; - if (*maxrec != vbuf->rec) + if (*maxrec != ntohl(vbuf->rec)) continue; if ((ch = (*db->del)(db, &key, R_CURSOR)) < 0) |