summaryrefslogtreecommitdiff
path: root/include/db.h
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2007-02-03 23:48:21 +0000
committerchristos <christos@NetBSD.org>2007-02-03 23:48:21 +0000
commitfc500ab7fb3a60fc2f332b9cf414bbe38664faa5 (patch)
tree818cfeca1f57e5891073b1bcf285af251d861666 /include/db.h
parent016db3548ec1ce48db4716d138528a3f90c5b203 (diff)
Add macros for overflow detection
Diffstat (limited to 'include/db.h')
-rw-r--r--include/db.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/db.h b/include/db.h
index 0f53898b84a..5855c3c862b 100644
--- a/include/db.h
+++ b/include/db.h
@@ -1,4 +1,4 @@
-/* $NetBSD: db.h,v 1.22 2005/12/26 19:01:47 perry Exp $ */
+/* $NetBSD: db.h,v 1.23 2007/02/03 23:48:21 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -213,6 +213,10 @@ __BEGIN_DECLS
DB *dbopen(const char *, int, mode_t, DBTYPE, const void *);
#ifdef __DBINTERFACE_PRIVATE
+
+#define _DBMASK(a) (~((1ULL << (sizeof(a) * NBBY)) - 1))
+#define _DBFIT(a, t) _DIAGASSERT(((a) & _DBMASK(t)) == 0)
+
DB *__bt_open(const char *, int, mode_t, const BTREEINFO *, int);
DB *__hash_open(const char *, int, mode_t, const HASHINFO *, int);
DB *__rec_open(const char *, int, mode_t, const RECNOINFO *, int);