summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-09-24 15:18:36 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-09-29 16:07:45 +1000
commitd1dff562e256cf3726f8ec229feced879f212096 (patch)
tree08f2e2b6215f2a73601cabe275e91bd6ebf1677a
parent6f6281c978507312def82af8fa6dd020b9fcb1a6 (diff)
downloadmongo-d1dff562e256cf3726f8ec229feced879f212096.tar.gz
WT-2122 Convert more expressions to use bool
Merge pull request #2208 from wiredtiger/more-bool (cherry picked from commit f1837bf787832c818d226df4c662093d124b01f8)
-rw-r--r--dist/s_define.list10
-rw-r--r--src/block/block_addr.c2
-rw-r--r--src/block/block_compact.c14
-rw-r--r--src/block/block_mgr.c8
-rw-r--r--src/block/block_open.c3
-rw-r--r--src/block/block_vrfy.c8
-rw-r--r--src/btree/bt_compact.c14
-rw-r--r--src/btree/bt_cursor.c2
-rw-r--r--src/btree/bt_delete.c6
-rw-r--r--src/btree/bt_split.c23
-rw-r--r--src/btree/bt_walk.c10
-rw-r--r--src/conn/conn_cache.c2
-rw-r--r--src/conn/conn_dhandle.c2
-rw-r--r--src/conn/conn_log.c13
-rw-r--r--src/cursor/cur_backup.c2
-rw-r--r--src/cursor/cur_bulk.c2
-rw-r--r--src/cursor/cur_dump.c12
-rw-r--r--src/cursor/cur_std.c16
-rw-r--r--src/cursor/cur_table.c2
-rw-r--r--src/include/block.h8
-rw-r--r--src/include/btree.i3
-rw-r--r--src/include/cell.i11
-rw-r--r--src/include/extern.h28
-rw-r--r--src/include/misc.h26
-rw-r--r--src/log/log.c6
-rw-r--r--src/lsm/lsm_cursor.c8
-rw-r--r--src/lsm/lsm_tree.c18
-rw-r--r--src/lsm/lsm_worker.c2
-rw-r--r--src/reconcile/rec_write.c6
-rw-r--r--src/schema/schema_project.c9
-rw-r--r--src/schema/schema_worker.c6
-rw-r--r--src/session/session_compact.c4
-rw-r--r--src/session/session_dhandle.c15
-rw-r--r--src/support/scratch.c6
-rw-r--r--src/txn/txn_ckpt.c6
-rw-r--r--src/txn/txn_log.c6
-rw-r--r--src/txn/txn_recover.c4
-rw-r--r--test/format/format.h4
38 files changed, 169 insertions, 158 deletions
diff --git a/dist/s_define.list b/dist/s_define.list
index 91c703e66e8..1ad29fe21ba 100644
--- a/dist/s_define.list
+++ b/dist/s_define.list
@@ -3,12 +3,8 @@ ALIGN_CHECK
API_CALL
API_CALL_NOCONF
API_SESSION_INIT
-FLD_CLR
-F_CAS_ATOMIC
-F_CLR_ATOMIC
-F_SET_ATOMIC
-LF_CLR
-LF_SET
+FLD_MASK
+LF_MASK
LLONG_MAX
LLONG_MIN
SIZE_CHECK
@@ -18,7 +14,6 @@ TXN_API_END
WIN32_LEAN_AND_MEAN
WT_ATOMIC_CAS
WT_ATOMIC_FUNC
-WT_BARRIER
WT_BLOCK_DESC_SIZE
WT_CACHE_LINE_ALIGNMENT
WT_COMPILER_TYPE_ALIGN
@@ -36,6 +31,7 @@ WT_STAT_ATOMIC_DECR
WT_STAT_ATOMIC_DECRV
WT_STAT_ATOMIC_INCR
WT_STAT_ATOMIC_INCRV
+WT_SESSION_LOCKED_CHECKPOINT
WT_STAT_DECR
WT_STAT_DECRV
WT_STAT_FAST_ATOMIC_DECR
diff --git a/src/block/block_addr.c b/src/block/block_addr.c
index ccee83a7d5d..ff41ccd87f8 100644
--- a/src/block/block_addr.c
+++ b/src/block/block_addr.c
@@ -35,7 +35,7 @@ __block_buffer_to_addr(WT_BLOCK *block,
* can be invalid offsets, that's simpler than testing sizes of 0 all
* over the place.
*/
- if (s == 0) {
+ if (s == 0) {
*offsetp = 0;
*sizep = *cksump = 0;
} else {
diff --git a/src/block/block_compact.c b/src/block/block_compact.c
index 6cd01e17eee..bd5fff17d07 100644
--- a/src/block/block_compact.c
+++ b/src/block/block_compact.c
@@ -49,7 +49,7 @@ __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
* Return if compaction will shrink the file.
*/
int
-__wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp)
+__wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp)
{
WT_DECL_RET;
WT_EXT *ext;
@@ -57,7 +57,7 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp)
WT_FH *fh;
wt_off_t avail_eighty, avail_ninety, eighty, ninety;
- *skipp = 1; /* Return a default skip. */
+ *skipp = true; /* Return a default skip. */
fh = block->fh;
@@ -119,11 +119,11 @@ __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp)
*/
if (avail_eighty > WT_MEGABYTE &&
avail_eighty >= ((fh->size / 10) * 2)) {
- *skipp = 0;
+ *skipp = false;
block->compact_pct_tenths = 2;
} else if (avail_ninety > WT_MEGABYTE &&
avail_ninety >= fh->size / 10) {
- *skipp = 0;
+ *skipp = false;
block->compact_pct_tenths = 1;
}
@@ -138,7 +138,7 @@ err: __wt_spin_unlock(session, &block->live_lock);
*/
int
__wt_block_compact_page_skip(WT_SESSION_IMPL *session,
- WT_BLOCK *block, const uint8_t *addr, size_t addr_size, int *skipp)
+ WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp)
{
WT_DECL_RET;
WT_EXT *ext;
@@ -148,7 +148,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
uint32_t size, cksum;
WT_UNUSED(addr_size);
- *skipp = 1; /* Return a default skip. */
+ *skipp = true; /* Return a default skip. */
fh = block->fh;
@@ -170,7 +170,7 @@ __wt_block_compact_page_skip(WT_SESSION_IMPL *session,
if (ext->off >= limit)
break;
if (ext->size >= size) {
- *skipp = 0;
+ *skipp = false;
break;
}
}
diff --git a/src/block/block_mgr.c b/src/block/block_mgr.c
index 84d065a0abe..d1875d73bea 100644
--- a/src/block/block_mgr.c
+++ b/src/block/block_mgr.c
@@ -183,7 +183,7 @@ __bm_compact_start(WT_BM *bm, WT_SESSION_IMPL *session)
*/
static int
__bm_compact_page_skip(WT_BM *bm, WT_SESSION_IMPL *session,
- const uint8_t *addr, size_t addr_size, int *skipp)
+ const uint8_t *addr, size_t addr_size, bool *skipp)
{
return (__wt_block_compact_page_skip(
session, bm->block, addr, addr_size, skipp));
@@ -194,7 +194,7 @@ __bm_compact_page_skip(WT_BM *bm, WT_SESSION_IMPL *session,
* Return if a file can be compacted.
*/
static int
-__bm_compact_skip(WT_BM *bm, WT_SESSION_IMPL *session, int *skipp)
+__bm_compact_skip(WT_BM *bm, WT_SESSION_IMPL *session, bool *skipp)
{
return (__wt_block_compact_skip(session, bm->block, skipp));
}
@@ -350,9 +350,9 @@ __bm_method_set(WT_BM *bm, bool readonly)
bm->compact_end =
(int (*)(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
bm->compact_page_skip = (int (*)(WT_BM *, WT_SESSION_IMPL *,
- const uint8_t *, size_t, int *))__bm_readonly;
+ const uint8_t *, size_t, bool *))__bm_readonly;
bm->compact_skip = (int (*)
- (WT_BM *, WT_SESSION_IMPL *, int *))__bm_readonly;
+ (WT_BM *, WT_SESSION_IMPL *, bool *))__bm_readonly;
bm->compact_start =
(int (*)(WT_BM *, WT_SESSION_IMPL *))__bm_readonly;
bm->free = (int (*)(WT_BM *,
diff --git a/src/block/block_open.c b/src/block/block_open.c
index 12c998c7853..4f4b7c57279 100644
--- a/src/block/block_open.c
+++ b/src/block/block_open.c
@@ -213,8 +213,7 @@ __wt_block_open(WT_SESSION_IMPL *session,
WT_ERR(__wt_strdup(session, filename, &block->name));
WT_ERR(__wt_config_gets(session, cfg, "block_allocation", &cval));
- block->allocfirst =
- WT_STRING_MATCH("first", cval.str, cval.len) ? 1 : 0;
+ block->allocfirst = WT_STRING_MATCH("first", cval.str, cval.len);
/* Configuration: optional OS buffer cache maximum size. */
WT_ERR(__wt_config_gets(session, cfg, "os_cache_max", &cval));
diff --git a/src/block/block_vrfy.c b/src/block/block_vrfy.c
index 6231685af38..a945b4b2200 100644
--- a/src/block/block_vrfy.c
+++ b/src/block/block_vrfy.c
@@ -90,7 +90,7 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
* Set this before reading any extent lists: don't panic if we see
* corruption.
*/
- block->verify = 1;
+ block->verify = true;
/*
* We maintain an allocation list that is rolled forward through the
@@ -107,7 +107,7 @@ __wt_block_verify_start(WT_SESSION_IMPL *session,
/* Configuration: strict behavior on any error. */
WT_RET(__wt_config_gets(session, cfg, "strict", &cval));
- block->verify_strict = cval.val ? 1 : 0;
+ block->verify_strict = cval.val != 0;
return (0);
}
@@ -174,8 +174,8 @@ __wt_block_verify_end(WT_SESSION_IMPL *session, WT_BLOCK *block)
/* Confirm we verified every file block. */
ret = __verify_filefrag_chk(session, block);
- block->verify = 0;
- block->verify_strict = 0;
+ block->verify = false;
+ block->verify_strict = false;
block->verify_size = 0;
/* Discard the accumulated allocation list. */
diff --git a/src/btree/bt_compact.c b/src/btree/bt_compact.c
index 06cae2b7c37..3018d7ed3d7 100644
--- a/src/btree/bt_compact.c
+++ b/src/btree/bt_compact.c
@@ -13,7 +13,7 @@
* Return if a page needs to be re-written.
*/
static int
-__compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
+__compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
{
WT_BM *bm;
WT_DECL_RET;
@@ -22,7 +22,7 @@ __compact_rewrite(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
size_t addr_size;
const uint8_t *addr;
- *skipp = 1; /* Default skip. */
+ *skipp = true; /* Default skip. */
bm = S2BT(session)->bm;
page = ref->page;
@@ -76,7 +76,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
WT_REF *ref;
- int block_manager_begin, evict_reset, skip;
+ bool block_manager_begin, evict_reset, skip;
WT_UNUSED(cfg);
@@ -84,7 +84,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
btree = S2BT(session);
bm = btree->bm;
ref = NULL;
- block_manager_begin = 0;
+ block_manager_begin = false;
WT_STAT_FAST_DATA_INCR(session, session_compact);
@@ -139,7 +139,7 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
/* Start compaction. */
WT_ERR(bm->compact_start(bm, session));
- block_manager_begin = 1;
+ block_manager_begin = true;
/* Walk the tree reviewing pages to see if they should be re-written. */
for (;;) {
@@ -187,14 +187,14 @@ err: if (ref != NULL)
* Return if compaction requires we read this page.
*/
int
-__wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
+__wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
{
WT_BM *bm;
size_t addr_size;
u_int type;
const uint8_t *addr;
- *skipp = 0; /* Default to reading. */
+ *skipp = false; /* Default to reading. */
type = 0; /* Keep compiler quiet. */
bm = S2BT(session)->bm;
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c
index 5ebc8613516..0b5d9e118d4 100644
--- a/src/btree/bt_cursor.c
+++ b/src/btree/bt_cursor.c
@@ -63,7 +63,7 @@ static inline int
__cursor_fix_implicit(WT_BTREE *btree, WT_CURSOR_BTREE *cbt)
{
return (btree->type == BTREE_COL_FIX &&
- !F_ISSET(cbt, WT_CBT_MAX_RECORD) ? 1 : 0);
+ !F_ISSET(cbt, WT_CBT_MAX_RECORD));
}
/*
diff --git a/src/btree/bt_delete.c b/src/btree/bt_delete.c
index 3cf581dcfd2..1e3ab0dc151 100644
--- a/src/btree/bt_delete.c
+++ b/src/btree/bt_delete.c
@@ -61,12 +61,12 @@
* If deleting a range, try to delete the page without instantiating it.
*/
int
-__wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
+__wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp)
{
WT_DECL_RET;
WT_PAGE *parent;
- *skipp = 0;
+ *skipp = false;
/* If we have a clean page in memory, attempt to evict it. */
if (ref->state == WT_REF_MEM &&
@@ -137,7 +137,7 @@ __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp)
WT_ERR(__wt_txn_modify_ref(session, ref));
- *skipp = 1;
+ *skipp = true;
WT_PUBLISH(ref->state, WT_REF_DELETED);
return (0);
diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c
index 390d6544014..b553a823b2e 100644
--- a/src/btree/bt_split.c
+++ b/src/btree/bt_split.c
@@ -145,16 +145,16 @@ __wt_split_stash_discard_all(
*/
static int
__split_safe_free(WT_SESSION_IMPL *session,
- uint64_t split_gen, int exclusive, void *p, size_t s)
+ uint64_t split_gen, bool closing, void *p, size_t s)
{
/*
- * We have swapped something in a page: if we don't have exclusive
+ * We have swapped something in a page: if we don't have closing
* access, check whether there are other threads in the same tree.
*/
- if (!exclusive && __split_oldest_gen(session) > split_gen)
- exclusive = 1;
+ if (!closing && __split_oldest_gen(session) > split_gen)
+ closing = true;
- if (exclusive) {
+ if (closing) {
__wt_free(session, p);
return (0);
}
@@ -352,7 +352,6 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page)
first = true;
WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) {
- WT_INTL_FOREACH_BEGIN(session, page, ref) {
__wt_ref_key(page, ref, &next->data, &next->size);
if (last->size == 0) {
if (first)
@@ -793,7 +792,7 @@ __wt_multi_to_ref(WT_SESSION_IMPL *session,
*/
static int
__split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
- WT_REF **ref_new, uint32_t new_entries, size_t parent_incr, int exclusive)
+ WT_REF **ref_new, uint32_t new_entries, size_t parent_incr, bool closing)
{
WT_DECL_RET;
WT_IKEY *ikey;
@@ -1009,7 +1008,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
* Add it to the session discard list, to be freed when it's safe.
*/
size = sizeof(WT_PAGE_INDEX) + pindex->entries * sizeof(WT_REF *);
- WT_TRET(__split_safe_free(session, split_gen, exclusive, pindex, size));
+ WT_TRET(__split_safe_free(session, split_gen, closing, pindex, size));
parent_decr += size;
/*
@@ -1034,7 +1033,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref,
* Do the check here because we've just grown the parent page and
* are holding it locked.
*/
- if (ret == 0 && !exclusive &&
+ if (ret == 0 && !closing &&
__split_should_deepen(session, parent_ref, &children))
ret = __split_deepen(session, parent, children);
@@ -1293,7 +1292,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp)
*/
page = NULL;
if ((ret = __split_parent(
- session, ref, split_ref, 2, parent_incr, 0)) != 0) {
+ session, ref, split_ref, 2, parent_incr, false)) != 0) {
/*
* Move the insert list element back to the original page list.
* For simplicity, the previous skip list pointers originally
@@ -1387,7 +1386,7 @@ __wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref)
* Resolve a page split.
*/
int
-__wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
+__wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, bool closing)
{
WT_DECL_RET;
WT_PAGE *page;
@@ -1413,7 +1412,7 @@ __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
/* Split into the parent. */
WT_ERR(__split_parent(
- session, ref, ref_new, new_entries, parent_incr, exclusive));
+ session, ref, ref_new, new_entries, parent_incr, closing));
WT_STAT_FAST_CONN_INCR(session, cache_eviction_split);
WT_STAT_FAST_DATA_INCR(session, cache_eviction_split);
diff --git a/src/btree/bt_walk.c b/src/btree/bt_walk.c
index 2705f371fb5..6e1d182ed0b 100644
--- a/src/btree/bt_walk.c
+++ b/src/btree/bt_walk.c
@@ -81,11 +81,11 @@ __wt_tree_walk(WT_SESSION_IMPL *session,
WT_PAGE *page;
WT_PAGE_INDEX *pindex;
WT_REF *couple, *couple_orig, *ref;
- int empty_internal, prev, skip;
+ bool empty_internal, prev, skip;
uint32_t slot;
btree = S2BT(session);
- empty_internal = 0;
+ empty_internal = false;
/*
* Tree walks are special: they look inside page structures that splits
@@ -178,7 +178,7 @@ ascend: /*
*/
if (empty_internal) {
__wt_page_evict_soon(ref->page);
- empty_internal = 0;
+ empty_internal = false;
}
/* Optionally skip internal pages. */
@@ -241,7 +241,7 @@ ascend: /*
* page isn't empty.
*/
if (ref->state != WT_REF_DELETED)
- empty_internal = 0;
+ empty_internal = false;
if (LF_ISSET(WT_READ_CACHE)) {
/*
@@ -358,7 +358,7 @@ descend: couple = ref;
if (WT_PAGE_IS_INTERNAL(page)) {
WT_INTL_INDEX_GET(session, page, pindex);
slot = prev ? pindex->entries - 1 : 0;
- empty_internal = 1;
+ empty_internal = true;
} else {
*refp = ref;
goto done;
diff --git a/src/conn/conn_cache.c b/src/conn/conn_cache.c
index e00466d6bc5..a3d01b40414 100644
--- a/src/conn/conn_cache.c
+++ b/src/conn/conn_cache.c
@@ -77,7 +77,7 @@ __wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[])
{
WT_CONFIG_ITEM cval;
WT_CONNECTION_IMPL *conn;
- int now_shared, was_shared;
+ bool now_shared, was_shared;
conn = S2C(session);
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index f68004bbe03..048a0d6bd92 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -448,7 +448,7 @@ __conn_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags)
WT_RET(__conn_btree_config_set(session));
/* Set any special flags on the handle. */
- F_SET(btree, LF_ISSET(WT_BTREE_SPECIAL_FLAGS));
+ F_SET(btree, LF_MASK(WT_BTREE_SPECIAL_FLAGS));
do {
WT_ERR(__wt_btree_open(session, cfg));
diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c
index f9c26a86b92..817e7197d11 100644
--- a/src/conn/conn_log.c
+++ b/src/conn/conn_log.c
@@ -471,7 +471,18 @@ __log_server(void *arg)
session = arg;
conn = S2C(session);
log = conn->log;
- locked = false;
+
+ /*
+ * The log server thread does a variety of work. It forces out any
+ * buffered log writes. It pre-allocates log files and it performs
+ * log archiving. The reason the wrlsn thread does not force out
+ * the buffered writes is because we want to process and move the
+ * write_lsn forward as quickly as possible. The same reason applies
+ * to why the log file server thread does not force out the writes.
+ * That thread does fsync calls which can take a long time and we
+ * don't want log records sitting in the buffer over the time it
+ * takes to sync out an earlier file.
+ */
while (F_ISSET(conn, WT_CONN_LOG_SERVER_RUN)) {
/*
* Perform log pre-allocation.
diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c
index 4232270c406..d34e3ea10a1 100644
--- a/src/cursor/cur_backup.c
+++ b/src/cursor/cur_backup.c
@@ -481,7 +481,7 @@ __wt_backup_file_remove(WT_SESSION_IMPL *session)
*/
int
__wt_backup_list_uri_append(
- WT_SESSION_IMPL *session, const char *name, int *skip)
+ WT_SESSION_IMPL *session, const char *name, bool *skip)
{
WT_CURSOR_BACKUP *cb;
char *value;
diff --git a/src/cursor/cur_bulk.c b/src/cursor/cur_bulk.c
index df7048d4b82..df0616eb316 100644
--- a/src/cursor/cur_bulk.c
+++ b/src/cursor/cur_bulk.c
@@ -225,7 +225,7 @@ err: API_END_RET(session, ret);
*/
int
__wt_curbulk_init(WT_SESSION_IMPL *session,
- WT_CURSOR_BULK *cbulk, int bitmap, int skip_sort_check)
+ WT_CURSOR_BULK *cbulk, int bitmap, bool skip_sort_check)
{
WT_CURSOR *c;
WT_CURSOR_BTREE *cbt;
diff --git a/src/cursor/cur_dump.c b/src/cursor/cur_dump.c
index 00281054d22..9323fa9483a 100644
--- a/src/cursor/cur_dump.c
+++ b/src/cursor/cur_dump.c
@@ -15,7 +15,7 @@
*/
static int
__raw_to_dump(
- WT_SESSION_IMPL *session, WT_ITEM *from, WT_ITEM *to, int hexonly)
+ WT_SESSION_IMPL *session, WT_ITEM *from, WT_ITEM *to, bool hexonly)
{
if (hexonly)
WT_RET(__wt_raw_to_hex(session, from->data, from->size, to));
@@ -98,7 +98,7 @@ __curdump_get_key(WT_CURSOR *cursor, ...)
WT_ERR(child->get_key(child, &item));
WT_ERR(__raw_to_dump(session, &item, &cursor->key,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
}
if (F_ISSET(cursor, WT_CURSTD_RAW)) {
@@ -179,7 +179,7 @@ __curdump_set_key(WT_CURSOR *cursor, ...)
&cursor->key));
else
WT_ERR(__dump_to_raw(session, p, &cursor->key,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
child->set_key(child, &cursor->key);
}
@@ -225,7 +225,7 @@ __curdump_get_value(WT_CURSOR *cursor, ...)
WT_ERR(child->get_value(child, &item));
WT_ERR(__raw_to_dump(session, &item, &cursor->value,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
if (F_ISSET(cursor, WT_CURSTD_RAW)) {
itemp = va_arg(ap, WT_ITEM *);
@@ -269,7 +269,7 @@ __curdump_set_value(WT_CURSOR *cursor, ...)
(WT_CURSOR_JSON *)cursor->json_private, 0, &cursor->value));
else
WT_ERR(__dump_to_raw(session, p, &cursor->value,
- F_ISSET(cursor, WT_CURSTD_DUMP_HEX) ? 1 : 0));
+ F_ISSET(cursor, WT_CURSTD_DUMP_HEX)));
child->set_value(child, &cursor->value);
@@ -384,7 +384,7 @@ __wt_curdump_create(WT_CURSOR *child, WT_CURSOR *owner, WT_CURSOR **cursorp)
cdump->child = child;
/* Copy the dump flags from the child cursor. */
- F_SET(cursor, F_ISSET(child,
+ F_SET(cursor, F_MASK(child,
WT_CURSTD_DUMP_HEX | WT_CURSTD_DUMP_JSON | WT_CURSTD_DUMP_PRINT));
if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON)) {
WT_ERR(__wt_calloc_one(session, &json));
diff --git a/src/cursor/cur_std.c b/src/cursor/cur_std.c
index 858c6af6853..3bb64a22b0e 100644
--- a/src/cursor/cur_std.c
+++ b/src/cursor/cur_std.c
@@ -113,9 +113,9 @@ int
__wt_cursor_get_raw_key(WT_CURSOR *cursor, WT_ITEM *key)
{
WT_DECL_RET;
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
ret = cursor->get_key(cursor, key);
@@ -132,9 +132,9 @@ __wt_cursor_get_raw_key(WT_CURSOR *cursor, WT_ITEM *key)
void
__wt_cursor_set_raw_key(WT_CURSOR *cursor, WT_ITEM *key)
{
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
cursor->set_key(cursor, key);
@@ -151,9 +151,9 @@ int
__wt_cursor_get_raw_value(WT_CURSOR *cursor, WT_ITEM *value)
{
WT_DECL_RET;
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
ret = cursor->get_value(cursor, value);
@@ -170,9 +170,9 @@ __wt_cursor_get_raw_value(WT_CURSOR *cursor, WT_ITEM *value)
void
__wt_cursor_set_raw_value(WT_CURSOR *cursor, WT_ITEM *value)
{
- int raw_set;
+ bool raw_set;
- raw_set = F_ISSET(cursor, WT_CURSTD_RAW) ? 1 : 0;
+ raw_set = F_ISSET(cursor, WT_CURSTD_RAW);
if (!raw_set)
F_SET(cursor, WT_CURSTD_RAW);
cursor->set_value(cursor, value);
diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c
index a046b2b1ed9..9834b247341 100644
--- a/src/cursor/cur_table.c
+++ b/src/cursor/cur_table.c
@@ -504,7 +504,7 @@ __curtable_insert(WT_CURSOR *cursor)
cp = ctable->cg_cursors;
primary = *cp++;
- flag_orig = F_ISSET(primary, WT_CURSTD_OVERWRITE);
+ flag_orig = F_MASK(primary, WT_CURSTD_OVERWRITE);
if (ctable->table->nindices > 0)
F_CLR(primary, WT_CURSTD_OVERWRITE);
ret = primary->insert(primary);
diff --git a/src/include/block.h b/src/include/block.h
index 6e0de069b3f..0914e5323fc 100644
--- a/src/include/block.h
+++ b/src/include/block.h
@@ -168,8 +168,8 @@ struct __wt_bm {
int (*close)(WT_BM *, WT_SESSION_IMPL *);
int (*compact_end)(WT_BM *, WT_SESSION_IMPL *);
int (*compact_page_skip)
- (WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t, int *);
- int (*compact_skip)(WT_BM *, WT_SESSION_IMPL *, int *);
+ (WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t, bool *);
+ int (*compact_skip)(WT_BM *, WT_SESSION_IMPL *, bool *);
int (*compact_start)(WT_BM *, WT_SESSION_IMPL *);
int (*free)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t);
int (*preload)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t);
@@ -246,8 +246,8 @@ struct __wt_block {
wt_off_t slvg_off; /* Salvage file offset */
/* Verification support */
- int verify; /* If performing verification */
- int verify_strict; /* Fail hard on any error */
+ bool verify; /* If performing verification */
+ bool verify_strict; /* Fail hard on any error */
wt_off_t verify_size; /* Checkpoint's file size */
WT_EXTLIST verify_alloc; /* Verification allocation list */
uint64_t frags; /* Maximum frags in the file */
diff --git a/src/include/btree.i b/src/include/btree.i
index 07f11b0c06c..1cf0c9a8aff 100644
--- a/src/include/btree.i
+++ b/src/include/btree.i
@@ -1079,7 +1079,8 @@ __wt_page_release_evict(WT_SESSION_IMPL *session, WT_REF *ref)
WT_BTREE *btree;
WT_DECL_RET;
WT_PAGE *page;
- int locked, too_big;
+ int locked;
+ bool too_big;
btree = S2BT(session);
page = ref->page;
diff --git a/src/include/cell.i b/src/include/cell.i
index 880e4e2402f..763a8229d85 100644
--- a/src/include/cell.i
+++ b/src/include/cell.i
@@ -230,11 +230,12 @@ __wt_cell_pack_data(WT_CELL *cell, uint64_t rle, size_t size)
*/
static inline int
__wt_cell_pack_data_match(
- WT_CELL *page_cell, WT_CELL *val_cell, const uint8_t *val_data, int *matchp)
+ WT_CELL *page_cell, WT_CELL *val_cell, const uint8_t *val_data,
+ bool *matchp)
{
const uint8_t *a, *b;
uint64_t av, bv;
- int rle;
+ bool rle;
*matchp = 0; /* Default to no-match */
@@ -252,7 +253,7 @@ __wt_cell_pack_data_match(
av = a[0] >> WT_CELL_SHORT_SHIFT;
++a;
} else if (WT_CELL_TYPE(a[0]) == WT_CELL_VALUE) {
- rle = a[0] & WT_CELL_64V ? 1 : 0; /* Skip any RLE */
+ rle = (a[0] & WT_CELL_64V) != 0; /* Skip any RLE */
++a;
if (rle)
WT_RET(__wt_vunpack_uint(&a, 0, &av));
@@ -264,7 +265,7 @@ __wt_cell_pack_data_match(
bv = b[0] >> WT_CELL_SHORT_SHIFT;
++b;
} else if (WT_CELL_TYPE(b[0]) == WT_CELL_VALUE) {
- rle = b[0] & WT_CELL_64V ? 1 : 0; /* Skip any RLE */
+ rle = (b[0] & WT_CELL_64V) != 0; /* Skip any RLE */
++b;
if (rle)
WT_RET(__wt_vunpack_uint(&b, 0, &bv));
@@ -273,7 +274,7 @@ __wt_cell_pack_data_match(
return (0);
if (av == bv)
- *matchp = memcmp(a, val_data, av) == 0 ? 1 : 0;
+ *matchp = memcmp(a, val_data, av) == 0;
return (0);
}
diff --git a/src/include/extern.h b/src/include/extern.h
index 80028817a5c..adaeed31bba 100644
--- a/src/include/extern.h
+++ b/src/include/extern.h
@@ -23,8 +23,8 @@ extern int __wt_block_checkpoint(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_I
extern int __wt_block_checkpoint_resolve(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_block_compact_start(WT_SESSION_IMPL *session, WT_BLOCK *block);
extern int __wt_block_compact_end(WT_SESSION_IMPL *session, WT_BLOCK *block);
-extern int __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, int *skipp);
-extern int __wt_block_compact_page_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, int *skipp);
+extern int __wt_block_compact_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, bool *skipp);
+extern int __wt_block_compact_page_skip(WT_SESSION_IMPL *session, WT_BLOCK *block, const uint8_t *addr, size_t addr_size, bool *skipp);
extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *tag, wt_off_t offset, uint32_t size, bool live);
extern int __wt_block_off_remove_overlap(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, wt_off_t off, wt_off_t size);
extern int __wt_block_alloc( WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t *offp, wt_off_t size);
@@ -86,7 +86,7 @@ extern int __wt_bloom_get(WT_BLOOM *bloom, WT_ITEM *key);
extern int __wt_bloom_close(WT_BLOOM *bloom);
extern int __wt_bloom_drop(WT_BLOOM *bloom, const char *config);
extern int __wt_compact(WT_SESSION_IMPL *session, const char *cfg[]);
-extern int __wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp);
+extern int __wt_compact_page_skip(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp);
extern void __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt);
extern int __wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating);
extern int __wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating);
@@ -112,7 +112,7 @@ extern int __wt_debug_tree_shape( WT_SESSION_IMPL *session, WT_PAGE *page, const
extern int __wt_debug_tree_all(WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile);
extern int __wt_debug_tree(WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile);
extern int __wt_debug_page(WT_SESSION_IMPL *session, WT_PAGE *page, const char *ofile);
-extern int __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, int *skipp);
+extern int __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp);
extern void __wt_delete_page_rollback(WT_SESSION_IMPL *session, WT_REF *ref);
extern bool __wt_delete_page_skip(WT_SESSION_IMPL *session, WT_REF *ref);
extern int __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref);
@@ -154,7 +154,7 @@ extern void __wt_split_stash_discard_all( WT_SESSION_IMPL *session_safe, WT_SESS
extern int __wt_multi_to_ref(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi, WT_REF **refp, size_t *incrp);
extern int __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref, int *splitp);
extern int __wt_split_rewrite(WT_SESSION_IMPL *session, WT_REF *ref);
-extern int __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive);
+extern int __wt_split_multi(WT_SESSION_IMPL *session, WT_REF *ref, bool closing);
extern int __wt_btree_stat_init(WT_SESSION_IMPL *session, WT_CURSOR_STAT *cst);
extern int __wt_cache_op(WT_SESSION_IMPL *session, WT_CKPT *ckptbase, int op);
extern int __wt_upgrade(WT_SESSION_IMPL *session, const char *cfg[]);
@@ -253,8 +253,8 @@ extern int __wt_sweep_create(WT_SESSION_IMPL *session);
extern int __wt_sweep_destroy(WT_SESSION_IMPL *session);
extern int __wt_curbackup_open(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_backup_file_remove(WT_SESSION_IMPL *session);
-extern int __wt_backup_list_uri_append( WT_SESSION_IMPL *session, const char *name, int *skip);
-extern int __wt_curbulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk, int bitmap, int skip_sort_check);
+extern int __wt_backup_list_uri_append( WT_SESSION_IMPL *session, const char *name, bool *skip);
+extern int __wt_curbulk_init(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk, int bitmap, bool skip_sort_check);
extern int __wt_curconfig_open(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_curds_open( WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_DATA_SOURCE *dsrc, WT_CURSOR **cursorp);
extern int __wt_curdump_create(WT_CURSOR *child, WT_CURSOR *owner, WT_CURSOR **cursorp);
@@ -318,7 +318,7 @@ extern int __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing);
extern void __wt_evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref);
extern int __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn);
extern int __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn);
-extern int __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec);
+extern int __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, bool *recp);
extern void __wt_log_written_reset(WT_SESSION_IMPL *session);
extern int __wt_log_get_all_files(WT_SESSION_IMPL *session, char ***filesp, u_int *countp, uint32_t *maxid, int active_only);
extern void __wt_log_files_free(WT_SESSION_IMPL *session, char **files, u_int count);
@@ -402,8 +402,8 @@ extern int __wt_lsm_tree_readlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tre
extern int __wt_lsm_tree_readunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
extern int __wt_lsm_tree_writelock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
extern int __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
-extern int __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip);
-extern int __wt_lsm_tree_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, int *), const char *cfg[], uint32_t open_flags);
+extern int __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp);
+extern int __wt_lsm_tree_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, bool *), const char *cfg[], uint32_t open_flags);
extern int __wt_lsm_get_chunk_to_flush(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int force, WT_LSM_CHUNK **chunkp);
extern int __wt_lsm_work_switch( WT_SESSION_IMPL *session, WT_LSM_WORK_UNIT **entryp, int *ran);
extern int __wt_lsm_work_bloom(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree);
@@ -562,7 +562,7 @@ extern int __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, const
extern int __wt_struct_truncate(WT_SESSION_IMPL *session, const char *input_fmt, u_int ncols, WT_ITEM *format);
extern int __wt_schema_project_in(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, va_list ap);
extern int __wt_schema_project_out(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, va_list ap);
-extern int __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, int key_only, const char *vformat, WT_ITEM *value);
+extern int __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, bool key_only, const char *vformat, WT_ITEM *value);
extern int __wt_schema_project_merge(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, const char *vformat, WT_ITEM *value);
extern int __wt_schema_rename(WT_SESSION_IMPL *session, const char *uri, const char *newuri, const char *cfg[]);
extern int __wt_curstat_colgroup_init(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR_STAT *cst);
@@ -574,16 +574,16 @@ extern int __wt_schema_range_truncate( WT_SESSION_IMPL *session, WT_CURSOR *star
extern WT_DATA_SOURCE *__wt_schema_get_source(WT_SESSION_IMPL *session, const char *name);
extern int __wt_str_name_check(WT_SESSION_IMPL *session, const char *str);
extern int __wt_name_check(WT_SESSION_IMPL *session, const char *str, size_t len);
-extern int __wt_schema_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, int *), const char *cfg[], uint32_t open_flags);
+extern int __wt_schema_worker(WT_SESSION_IMPL *session, const char *uri, int (*file_func)(WT_SESSION_IMPL *, const char *[]), int (*name_func)(WT_SESSION_IMPL *, const char *, bool *), const char *cfg[], uint32_t open_flags);
extern int __wt_session_reset_cursors(WT_SESSION_IMPL *session);
extern int __wt_session_copy_values(WT_SESSION_IMPL *session);
extern int __wt_open_cursor(WT_SESSION_IMPL *session, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp);
extern int __wt_session_create_strip(WT_SESSION *wt_session, const char *v1, const char *v2, char **value_ret);
extern int __wt_open_internal_session(WT_CONNECTION_IMPL *conn, const char *name, int uses_dhandles, int open_metadata, WT_SESSION_IMPL **sessionp);
extern int __wt_open_session(WT_CONNECTION_IMPL *conn, WT_EVENT_HANDLER *event_handler, const char *config, WT_SESSION_IMPL **sessionp);
-extern int __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip);
+extern int __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, bool *skipp);
extern int __wt_session_compact( WT_SESSION *wt_session, const char *uri, const char *config);
-extern int __wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp);
+extern int __wt_session_lock_dhandle( WT_SESSION_IMPL *session, uint32_t flags, bool *is_deadp);
extern int __wt_session_release_btree(WT_SESSION_IMPL *session);
extern int __wt_session_get_btree_ckpt(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], uint32_t flags);
extern void __wt_session_close_cache(WT_SESSION_IMPL *session);
diff --git a/src/include/misc.h b/src/include/misc.h
index ba12f00f672..e2b46d0dbdc 100644
--- a/src/include/misc.h
+++ b/src/include/misc.h
@@ -114,17 +114,21 @@
* hex constant might be a negative integer), and to ensure the hex constant is
* the correct size before applying the bitwise not operator.
*/
-#define F_CLR(p, mask) ((p)->flags &= ~((uint32_t)(mask)))
-#define F_ISSET(p, mask) ((p)->flags & ((uint32_t)(mask)))
-#define F_SET(p, mask) ((p)->flags |= ((uint32_t)(mask)))
-
-#define LF_CLR(mask) ((flags) &= ~((uint32_t)(mask)))
-#define LF_ISSET(mask) ((flags) & ((uint32_t)(mask)))
-#define LF_SET(mask) ((flags) |= ((uint32_t)(mask)))
-
-#define FLD_CLR(field, mask) ((field) &= ~((uint32_t)(mask)))
-#define FLD_ISSET(field, mask) ((field) & ((uint32_t)(mask)))
-#define FLD_SET(field, mask) ((field) |= ((uint32_t)(mask)))
+#define FLD_CLR(field, mask) ((field) &= ~((uint32_t)(mask)))
+#define FLD_MASK(field, mask) ((field) & (uint32_t)(mask))
+#define FLD_ISSET(field, mask) (FLD_MASK(field, mask) != 0)
+#define FLD64_ISSET(field, mask) (((field) & (uint64_t)(mask)) != 0)
+#define FLD_SET(field, mask) ((field) |= ((uint32_t)(mask)))
+
+#define F_CLR(p, mask) FLD_CLR((p)->flags, mask)
+#define F_ISSET(p, mask) FLD_ISSET((p)->flags, mask)
+#define F_MASK(p, mask) FLD_MASK((p)->flags, mask)
+#define F_SET(p, mask) FLD_SET((p)->flags, mask)
+
+#define LF_CLR(mask) FLD_CLR(flags, mask)
+#define LF_ISSET(mask) FLD_ISSET(flags, mask)
+#define LF_MASK(mask) FLD_MASK(flags, mask)
+#define LF_SET(mask) FLD_SET(flags, mask)
/* Verbose messages. */
#ifdef HAVE_VERBOSE
diff --git a/src/log/log.c b/src/log/log.c
index 659e3556df9..1ad82b61673 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -99,7 +99,7 @@ err:
* must be run in the given variable.
*/
int
-__wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec)
+__wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, bool *recp)
{
WT_CONNECTION_IMPL *conn;
WT_CURSOR *c;
@@ -116,7 +116,7 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec)
* Default is to run recovery always (regardless of whether this
* connection has logging enabled).
*/
- *rec = 1;
+ *recp = true;
if (log == NULL)
return (0);
@@ -142,7 +142,7 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec)
* If we get to the end of the log, we can skip recovery.
*/
if (ret == WT_NOTFOUND) {
- *rec = 0;
+ *recp = false;
ret = 0;
}
} else if (ret == WT_NOTFOUND)
diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c
index 86209eb3dc1..0f3f6c6105d 100644
--- a/src/lsm/lsm_cursor.c
+++ b/src/lsm/lsm_cursor.c
@@ -100,15 +100,15 @@ __clsm_enter_update(WT_CURSOR_LSM *clsm)
WT_LSM_CHUNK *primary_chunk;
WT_LSM_TREE *lsm_tree;
WT_SESSION_IMPL *session;
- int hard_limit, have_primary, ovfl;
+ bool hard_limit, have_primary, ovfl;
lsm_tree = clsm->lsm_tree;
- ovfl = 0;
+ ovfl = false;
session = (WT_SESSION_IMPL *)clsm->iface.session;
if (clsm->nchunks == 0) {
primary = NULL;
- have_primary = 0;
+ have_primary = false;
} else {
primary = clsm->cursors[clsm->nchunks - 1];
primary_chunk = clsm->primary_chunk;
@@ -129,7 +129,7 @@ __clsm_enter_update(WT_CURSOR_LSM *clsm)
* chunk grows twice as large as the configured size, block until it
* can be switched.
*/
- hard_limit = F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH) ? 1 : 0;
+ hard_limit = F_ISSET(lsm_tree, WT_LSM_TREE_NEED_SWITCH);
if (have_primary) {
WT_ENTER_PAGE_INDEX(session);
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index f2eb580f471..a5709ac97ad 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -11,7 +11,7 @@
static int __lsm_tree_cleanup_old(WT_SESSION_IMPL *, const char *);
static int __lsm_tree_open_check(WT_SESSION_IMPL *, WT_LSM_TREE *);
static int __lsm_tree_open(
- WT_SESSION_IMPL *, const char *, int, WT_LSM_TREE **);
+ WT_SESSION_IMPL *, const char *, bool, WT_LSM_TREE **);
static int __lsm_tree_set_name(WT_SESSION_IMPL *, WT_LSM_TREE *, const char *);
/*
@@ -431,7 +431,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
*/
if (ret == 0)
WT_WITH_HANDLE_LIST_LOCK(session,
- ret = __lsm_tree_open(session, uri, 1, &lsm_tree));
+ ret = __lsm_tree_open(session, uri, true, &lsm_tree));
if (ret == 0)
__wt_lsm_tree_release(session, lsm_tree);
@@ -543,7 +543,7 @@ __lsm_tree_open_check(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
*/
static int
__lsm_tree_open(WT_SESSION_IMPL *session,
- const char *uri, int exclusive, WT_LSM_TREE **treep)
+ const char *uri, bool exclusive, WT_LSM_TREE **treep)
{
WT_CONNECTION_IMPL *conn;
WT_DECL_RET;
@@ -807,13 +807,13 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_DECL_RET;
WT_LSM_CHUNK *chunk, *last_chunk;
uint32_t chunks_moved, nchunks, new_id;
- int first_switch;
+ bool first_switch;
WT_RET(__wt_lsm_tree_writelock(session, lsm_tree));
nchunks = lsm_tree->nchunks;
- first_switch = nchunks == 0 ? 1 : 0;
+ first_switch = nchunks == 0;
/*
* Check if a switch is still needed: we may have raced while waiting
@@ -1190,7 +1190,7 @@ __wt_lsm_tree_writeunlock(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
* Compact an LSM tree called via __wt_schema_worker.
*/
int
-__wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
+__wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, bool *skipp)
{
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
@@ -1210,7 +1210,7 @@ __wt_lsm_compact(WT_SESSION_IMPL *session, const char *name, int *skip)
return (0);
/* Tell __wt_schema_worker not to look inside the LSM tree. */
- *skip = 1;
+ *skipp = true;
WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, name, 0, &lsm_tree));
@@ -1387,7 +1387,7 @@ int
__wt_lsm_tree_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *, const char *[]),
- int (*name_func)(WT_SESSION_IMPL *, const char *, int *),
+ int (*name_func)(WT_SESSION_IMPL *, const char *, bool *),
const char *cfg[], uint32_t open_flags)
{
WT_DECL_RET;
@@ -1397,7 +1397,7 @@ __wt_lsm_tree_worker(WT_SESSION_IMPL *session,
int exclusive, locked;
locked = 0;
- exclusive = FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE) ? 1 : 0;
+ exclusive = FLD_ISSET(open_flags, WT_DHANDLE_EXCLUSIVE);
WT_WITH_HANDLE_LIST_LOCK(session,
ret = __wt_lsm_tree_get(session, uri, exclusive, &lsm_tree));
WT_RET(ret);
diff --git a/src/lsm/lsm_worker.c b/src/lsm/lsm_worker.c
index 252523c5c57..6346791f905 100644
--- a/src/lsm/lsm_worker.c
+++ b/src/lsm/lsm_worker.c
@@ -35,7 +35,7 @@ __lsm_worker_general_op(
WT_DECL_RET;
WT_LSM_CHUNK *chunk;
WT_LSM_WORK_UNIT *entry;
- int force;
+ bool force;
*completed = 0;
/*
diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c
index 84a8f4bfde5..06955c80e4a 100644
--- a/src/reconcile/rec_write.c
+++ b/src/reconcile/rec_write.c
@@ -3312,6 +3312,7 @@ __rec_col_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
/* Deleted child we don't have to write. */
WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
+
case WT_CHILD_MODIFIED:
/*
* Modified child. Empty pages are merged into the
@@ -4143,9 +4144,10 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page)
session, page, kpack->cell));
WT_CHILD_RELEASE_ERR(session, hazard, ref);
continue;
+
case WT_CHILD_MODIFIED:
/*
- * Modified child. Empty pages are merged into the
+ * Modified child. Empty pages are merged into the
* parent and discarded.
*/
switch (child->modify->rec_result) {
@@ -5707,7 +5709,7 @@ __rec_dictionary_lookup(
{
WT_DICTIONARY *dp, *next;
uint64_t hash;
- int match;
+ bool match;
*dpp = NULL;
diff --git a/src/schema/schema_project.c b/src/schema/schema_project.c
index c9b69b3c922..be5f73b48ed 100644
--- a/src/schema/schema_project.c
+++ b/src/schema/schema_project.c
@@ -220,7 +220,7 @@ __wt_schema_project_out(WT_SESSION_IMPL *session,
*/
int
__wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
- const char *proj_arg, int key_only, const char *vformat, WT_ITEM *value)
+ const char *proj_arg, bool key_only, const char *vformat, WT_ITEM *value)
{
WT_CURSOR *c;
WT_DECL_ITEM(buf);
@@ -233,7 +233,7 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
uint8_t *end, *p;
const uint8_t *next, *vp, *vend;
size_t len, offset, old_len;
- int skip;
+ bool skip;
p = end = NULL; /* -Wuninitialized */
@@ -259,7 +259,7 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
switch (*proj) {
case WT_PROJ_KEY:
- skip = 0;
+ skip = false;
c = cp[arg];
if (WT_CURSOR_RECNO(c)) {
c->key.data = &c->recno;
@@ -274,7 +274,8 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp,
continue;
case WT_PROJ_VALUE:
- if ((skip = key_only) != 0)
+ skip = key_only;
+ if (skip)
continue;
c = cp[arg];
WT_RET(__pack_init(session, &pack, c->value_format));
diff --git a/src/schema/schema_worker.c b/src/schema/schema_worker.c
index 7d747f54a76..5bc67d1ae76 100644
--- a/src/schema/schema_worker.c
+++ b/src/schema/schema_worker.c
@@ -17,7 +17,7 @@ int
__wt_schema_worker(WT_SESSION_IMPL *session,
const char *uri,
int (*file_func)(WT_SESSION_IMPL *, const char *[]),
- int (*name_func)(WT_SESSION_IMPL *, const char *, int *),
+ int (*name_func)(WT_SESSION_IMPL *, const char *, bool *),
const char *cfg[], uint32_t open_flags)
{
WT_COLGROUP *colgroup;
@@ -28,12 +28,12 @@ __wt_schema_worker(WT_SESSION_IMPL *session,
WT_TABLE *table;
const char *tablename;
u_int i;
- int skip;
+ bool skip;
table = NULL;
tablename = uri;
- skip = 0;
+ skip = false;
if (name_func != NULL)
WT_ERR(name_func(session, uri, &skip));
diff --git a/src/session/session_compact.c b/src/session/session_compact.c
index 23fe0f0449d..8f3b63ed2eb 100644
--- a/src/session/session_compact.c
+++ b/src/session/session_compact.c
@@ -103,7 +103,7 @@
* Called via the schema_worker function.
*/
int
-__wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip)
+__wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, bool *skipp)
{
/*
* Add references to schema URI objects to the list of objects to be
@@ -112,7 +112,7 @@ __wt_compact_uri_analyze(WT_SESSION_IMPL *session, const char *uri, int *skip)
*/
if (WT_PREFIX_MATCH(uri, "lsm:")) {
session->compact->lsm_count++;
- *skip = 1;
+ *skipp = true;
} else if (WT_PREFIX_MATCH(uri, "file:"))
session->compact->file_count++;
diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c
index 8b23c3769c3..76b2ac06ebc 100644
--- a/src/session/session_dhandle.c
+++ b/src/session/session_dhandle.c
@@ -102,7 +102,8 @@ retry: TAILQ_FOREACH(dhandle_cache, &session->dhhash[bucket], hashq) {
* the schema lock.
*/
int
-__wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp)
+__wt_session_lock_dhandle(
+ WT_SESSION_IMPL *session, uint32_t flags, bool *is_deadp)
{
enum { NOLOCK, READLOCK, WRITELOCK } locked;
WT_BTREE *btree;
@@ -112,15 +113,15 @@ __wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp)
btree = S2BT(session);
dhandle = session->dhandle;
locked = NOLOCK;
- if (deadp != NULL)
- *deadp = 0;
+ if (is_deadp != NULL)
+ *is_deadp = false;
/*
* Special operation flags will cause the handle to be reopened.
* For example, a handle opened with WT_BTREE_BULK cannot use the same
* internal data structures as a handle opened for ordinary access.
*/
- special_flags = LF_ISSET(WT_BTREE_SPECIAL_FLAGS);
+ special_flags = LF_MASK(WT_BTREE_SPECIAL_FLAGS);
WT_ASSERT(session,
special_flags == 0 || LF_ISSET(WT_DHANDLE_EXCLUSIVE));
@@ -153,8 +154,8 @@ __wt_session_lock_dhandle(WT_SESSION_IMPL *session, uint32_t flags, int *deadp)
* that no special flags are required.
*/
if (F_ISSET(dhandle, WT_DHANDLE_DEAD)) {
- WT_ASSERT(session, deadp != NULL);
- *deadp = 1;
+ WT_ASSERT(session, is_deadp != NULL);
+ *is_deadp = 1;
} else if (LF_ISSET(WT_DHANDLE_LOCK_ONLY) ||
(F_ISSET(dhandle, WT_DHANDLE_OPEN) && special_flags == 0))
return (0);
@@ -377,7 +378,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
WT_DATA_HANDLE *dhandle;
WT_DATA_HANDLE_CACHE *dhandle_cache;
WT_DECL_RET;
- int is_dead;
+ bool is_dead;
WT_ASSERT(session, !F_ISSET(session, WT_SESSION_NO_DATA_HANDLES));
WT_ASSERT(session, !LF_ISSET(WT_DHANDLE_HAVE_REF));
diff --git a/src/support/scratch.c b/src/support/scratch.c
index 957101b8fae..ab29d0e99bd 100644
--- a/src/support/scratch.c
+++ b/src/support/scratch.c
@@ -17,7 +17,7 @@ int
__wt_buf_grow_worker(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size)
{
size_t offset;
- int copy_data;
+ bool copy_data;
/*
* Maintain the existing data: there are 3 cases:
@@ -30,10 +30,10 @@ __wt_buf_grow_worker(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size)
*/
if (WT_DATA_IN_ITEM(buf)) {
offset = WT_PTRDIFF(buf->data, buf->mem);
- copy_data = 0;
+ copy_data = false;
} else {
offset = 0;
- copy_data = buf->size ? 1 : 0;
+ copy_data = buf->size > 0;
}
/*
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index 2cecba087b5..ea1fbfef853 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -956,7 +956,7 @@ nockpt: F_SET(btree, WT_BTREE_SKIP_CKPT);
* names with checkpoints.
*/
if (is_checkpoint)
- switch (F_ISSET(btree, WT_BTREE_SPECIAL_FLAGS)) {
+ switch (F_MASK(btree, WT_BTREE_SPECIAL_FLAGS)) {
case 0:
break;
case WT_BTREE_BULK:
@@ -1158,10 +1158,10 @@ __wt_checkpoint_close(WT_SESSION_IMPL *session, int final)
{
WT_BTREE *btree;
WT_DECL_RET;
- int bulk, need_tracking;
+ bool bulk, need_tracking;
btree = S2BT(session);
- bulk = F_ISSET(btree, WT_BTREE_BULK) ? 1 : 0;
+ bulk = F_ISSET(btree, WT_BTREE_BULK);
/* If the handle is already dead, force the discard. */
if (F_ISSET(session->dhandle, WT_DHANDLE_DEAD))
diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c
index 26c1d7ba415..cb3c17a098b 100644
--- a/src/txn/txn_log.c
+++ b/src/txn/txn_log.c
@@ -456,12 +456,12 @@ __txn_printlog(WT_SESSION_IMPL *session,
FILE *out;
WT_LOG_RECORD *logrec;
WT_LSN ckpt_lsn;
- int compressed;
+ const uint8_t *end, *p;
+ const char *msg;
uint64_t txnid;
uint32_t fileid, rectype;
int32_t start;
- const uint8_t *end, *p;
- const char *msg;
+ bool compressed;
WT_UNUSED(next_lsnp);
out = cookie;
diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c
index 8c25c1685cf..f64d2d58cfc 100644
--- a/src/txn/txn_recover.c
+++ b/src/txn/txn_recover.c
@@ -415,12 +415,12 @@ __wt_txn_recover(WT_SESSION_IMPL *session)
WT_RECOVERY r;
struct WT_RECOVERY_FILE *metafile;
char *config;
- int needs_rec, was_backup;
+ bool needs_rec, was_backup;
conn = S2C(session);
WT_CLEAR(r);
WT_INIT_LSN(&r.ckpt_lsn);
- was_backup = F_ISSET(conn, WT_CONN_WAS_BACKUP) ? 1 : 0;
+ was_backup = F_ISSET(conn, WT_CONN_WAS_BACKUP);
/* We need a real session for recovery. */
WT_RET(__wt_open_session(conn, NULL, NULL, &session));
diff --git a/test/format/format.h b/test/format/format.h
index 650402ea775..7cd75cd0475 100644
--- a/test/format/format.h
+++ b/test/format/format.h
@@ -98,10 +98,6 @@ extern WT_EXTENSION_API *wt_api;
#undef GIGABYTE
#define GIGABYTE(v) ((v) * 1073741824ULL)
-#define F_CLR(p, mask) ((p)->flags &= ~((uint32_t)(mask)))
-#define F_ISSET(p, mask) ((p)->flags & ((uint32_t)(mask)))
-#define F_SET(p, mask) ((p)->flags |= ((uint32_t)(mask)))
-
#define WT_NAME "wt" /* Object name */
#define DATASOURCE(v) (strcmp(v, g.c_data_source) == 0 ? 1 : 0)