aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-01 23:55:58 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-01 23:55:58 +0000
commitba6b743ba088a1ee889f6315c05711d3e4505d61 (patch)
tree0a1b5c0d971b40567c23c9ae439439bf869f9a10 /mandocdb.c
parent80244c48e0ba678ad998cda0739a4d5dc399ac10 (diff)
downloadmandoc-ba6b743ba088a1ee889f6315c05711d3e4505d61.tar.gz
mandoc-ba6b743ba088a1ee889f6315c05711d3e4505d61.tar.zst
mandoc-ba6b743ba088a1ee889f6315c05711d3e4505d61.zip
Use OpenBSD's endian functions. Make btree type also be endian-neutral.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 1df2a00d..bea93986 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.19 2011/12/01 23:46:26 kristaps Exp $ */
+/* $Id: mandocdb.c,v 1.20 2011/12/01 23:55:58 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -33,8 +33,6 @@
#include <string.h>
#include <unistd.h>
-#include <arpa/inet.h>
-
#ifdef __linux__
# include <db_185.h>
#else
@@ -628,11 +626,11 @@ index_merge(const struct of *of, struct mparse *mp,
* into the database.
*/
- vbuf.rec = htonl(rec);
+ vbuf.rec = htobe32(rec);
seq = R_FIRST;
while (0 == (ch = (*hash->seq)(hash, &key, &val, seq))) {
seq = R_NEXT;
- vbuf.mask = *(uint64_t *)val.data;
+ vbuf.mask = htobe64(*(uint64_t *)val.data);
val.size = sizeof(struct db_val);
val.data = &vbuf;
dbt_put(db, dbf, &key, &val);
@@ -732,7 +730,7 @@ index_prune(const struct of *ofile, DB *db, const char *dbf,
break;
vbuf = val.data;
- if (*maxrec != ntohl(vbuf->rec))
+ if (*maxrec != betoh32(vbuf->rec))
continue;
if ((ch = (*db->del)(db, &key, R_CURSOR)) < 0)