diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-09-23 10:20:37 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-09-23 10:20:37 -0400 |
commit | 088a2ad25d214d00b116c638ddbb232b9e8b60cf (patch) | |
tree | 9bee25a31335392e80581eb7ba6e07527d517493 /src | |
parent | 759496b3e1cf7ac9045b5fc2bb09ea6d0485fd17 (diff) | |
download | mongo-088a2ad25d214d00b116c638ddbb232b9e8b60cf.tar.gz |
Boolean conversion for the rest of the btree code.
Diffstat (limited to 'src')
37 files changed, 284 insertions, 270 deletions
diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c index 49650efcdd4..55efe53c537 100644 --- a/src/btree/bt_curnext.c +++ b/src/btree/bt_curnext.c @@ -13,7 +13,7 @@ * Return the next entry on the append list. */ static inline int -__cursor_fix_append_next(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_fix_append_next(WT_CURSOR_BTREE *cbt, bool newpage) { WT_ITEM *val; WT_SESSION_IMPL *session; @@ -72,7 +72,7 @@ __cursor_fix_append_next(WT_CURSOR_BTREE *cbt, int newpage) * Move to the next, fixed-length column-store item. */ static inline int -__cursor_fix_next(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_fix_next(WT_CURSOR_BTREE *cbt, bool newpage) { WT_BTREE *btree; WT_ITEM *val; @@ -121,7 +121,7 @@ new_page: * Return the next variable-length entry on the append list. */ static inline int -__cursor_var_append_next(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_var_append_next(WT_CURSOR_BTREE *cbt, bool newpage) { WT_ITEM *val; WT_SESSION_IMPL *session; @@ -160,7 +160,7 @@ new_page: if (cbt->ins == NULL) * Move to the next, variable-length column-store item. */ static inline int -__cursor_var_next(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_var_next(WT_CURSOR_BTREE *cbt, bool newpage) { WT_CELL *cell; WT_CELL_UNPACK unpack; @@ -279,7 +279,7 @@ new_page: /* Find the matching WT_COL slot. */ * Move to the next row-store item. */ static inline int -__cursor_row_next(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_row_next(WT_CURSOR_BTREE *cbt, bool newpage) { WT_INSERT *ins; WT_ITEM *key, *val; @@ -373,12 +373,10 @@ new_insert: if ((ins = cbt->ins) != NULL) { * Initialize a cursor for iteration, usually based on a search. */ void -__wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next) +__wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt) { WT_PAGE *page; - WT_UNUSED(next); - /* * We don't currently have to do any setup when we switch between next * and prev calls, but I'm sure we will someday -- I'm leaving support @@ -437,13 +435,13 @@ __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next) * Move to the next record in the tree. */ int -__wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating) +__wt_btcur_next(WT_CURSOR_BTREE *cbt, bool truncating) { WT_DECL_RET; WT_PAGE *page; WT_SESSION_IMPL *session; uint32_t flags; - int newpage; + bool newpage; session = (WT_SESSION_IMPL *)cbt->iface.session; @@ -461,14 +459,14 @@ __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating) * some setup to do. */ if (!F_ISSET(cbt, WT_CBT_ITERATE_NEXT)) - __wt_btcur_iterate_setup(cbt, 1); + __wt_btcur_iterate_setup(cbt); /* * Walk any page we're holding until the underlying call returns not- * found. Then, move to the next page, until we reach the end of the * file. */ - for (newpage = 0;; newpage = 1) { + for (newpage = false;; newpage = true) { page = cbt->ref == NULL ? NULL : cbt->ref->page; WT_ASSERT(session, page == NULL || !WT_PAGE_IS_INTERNAL(page)); diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c index b514d9b8bb6..700e9bf1ba3 100644 --- a/src/btree/bt_curprev.c +++ b/src/btree/bt_curprev.c @@ -124,7 +124,7 @@ restart: * Return the previous fixed-length entry on the append list. */ static inline int -__cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, bool newpage) { WT_ITEM *val; WT_PAGE *page; @@ -209,7 +209,7 @@ __cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, int newpage) * Move to the previous, fixed-length column-store item. */ static inline int -__cursor_fix_prev(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_fix_prev(WT_CURSOR_BTREE *cbt, bool newpage) { WT_BTREE *btree; WT_ITEM *val; @@ -258,7 +258,7 @@ new_page: * Return the previous variable-length entry on the append list. */ static inline int -__cursor_var_append_prev(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_var_append_prev(WT_CURSOR_BTREE *cbt, bool newpage) { WT_ITEM *val; WT_SESSION_IMPL *session; @@ -297,7 +297,7 @@ new_page: if (cbt->ins == NULL) * Move to the previous, variable-length column-store item. */ static inline int -__cursor_var_prev(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_var_prev(WT_CURSOR_BTREE *cbt, bool newpage) { WT_CELL *cell; WT_CELL_UNPACK unpack; @@ -416,7 +416,7 @@ new_page: if (cbt->recno < page->pg_var_recno) * Move to the previous row-store item. */ static inline int -__cursor_row_prev(WT_CURSOR_BTREE *cbt, int newpage) +__cursor_row_prev(WT_CURSOR_BTREE *cbt, bool newpage) { WT_INSERT *ins; WT_ITEM *key, *val; @@ -523,13 +523,13 @@ new_insert: if ((ins = cbt->ins) != NULL) { * Move to the previous record in the tree. */ int -__wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating) +__wt_btcur_prev(WT_CURSOR_BTREE *cbt, bool truncating) { WT_DECL_RET; WT_PAGE *page; WT_SESSION_IMPL *session; uint32_t flags; - int newpage; + bool newpage; session = (WT_SESSION_IMPL *)cbt->iface.session; @@ -547,14 +547,14 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating) * some setup to do. */ if (!F_ISSET(cbt, WT_CBT_ITERATE_PREV)) - __wt_btcur_iterate_setup(cbt, 0); + __wt_btcur_iterate_setup(cbt); /* * Walk any page we're holding until the underlying call returns not- * found. Then, move to the previous page, until we reach the start * of the file. */ - for (newpage = 0;; newpage = 1) { + for (newpage = false;; newpage = true) { page = cbt->ref == NULL ? NULL : cbt->ref->page; WT_ASSERT(session, page == NULL || !WT_PAGE_IS_INTERNAL(page)); @@ -582,7 +582,7 @@ __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating) F_CLR(cbt, WT_CBT_ITERATE_APPEND); if (ret != WT_NOTFOUND) break; - newpage = 1; + newpage = true; } if (page != NULL) { switch (page->type) { diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index e60203799a5..48ebdb196c4 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -234,7 +234,7 @@ __cursor_col_search( */ static inline int __cursor_row_search( - WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_REF *leaf, int insert) + WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_REF *leaf, bool insert) { WT_DECL_RET; @@ -249,7 +249,7 @@ __cursor_row_search( */ static inline int __cursor_col_modify( - WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove) + WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, bool is_remove) { return (__wt_col_modify(session, cbt, cbt->iface.recno, &cbt->iface.value, NULL, is_remove)); @@ -261,7 +261,7 @@ __cursor_col_modify( */ static inline int __cursor_row_modify( - WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove) + WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, bool is_remove) { return (__wt_row_modify(session, cbt, &cbt->iface.key, &cbt->iface.value, NULL, is_remove)); @@ -296,7 +296,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt) WT_DECL_RET; WT_SESSION_IMPL *session; WT_UPDATE *upd; - int valid; + bool valid; btree = cbt->btree; cursor = &cbt->iface; @@ -314,13 +314,13 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt) * or the search of the pinned page doesn't find an exact match, search * from the root. */ - valid = 0; + valid = false; if (F_ISSET(cbt, WT_CBT_ACTIVE) && cbt->ref->page->read_gen != WT_READGEN_OLDEST) { __wt_txn_cursor_op(session); WT_ERR(btree->type == BTREE_ROW ? - __cursor_row_search(session, cbt, cbt->ref, 0) : + __cursor_row_search(session, cbt, cbt->ref, false) : __cursor_col_search(session, cbt, cbt->ref)); valid = cbt->compare == 0 && __cursor_valid(cbt, &upd); } @@ -328,7 +328,7 @@ __wt_btcur_search(WT_CURSOR_BTREE *cbt) WT_ERR(__cursor_func_init(cbt, 1)); WT_ERR(btree->type == BTREE_ROW ? - __cursor_row_search(session, cbt, NULL, 0) : + __cursor_row_search(session, cbt, NULL, false) : __cursor_col_search(session, cbt, NULL)); valid = cbt->compare == 0 && __cursor_valid(cbt, &upd); } @@ -364,7 +364,8 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) WT_DECL_RET; WT_SESSION_IMPL *session; WT_UPDATE *upd; - int exact, valid; + int exact; + bool valid; btree = cbt->btree; cursor = &cbt->iface; @@ -390,13 +391,13 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) * to position the cursor at the end of the tree, rather than match an * existing record. */ - valid = 0; + valid = false; if (btree->type == BTREE_ROW && F_ISSET(cbt, WT_CBT_ACTIVE) && cbt->ref->page->read_gen != WT_READGEN_OLDEST) { __wt_txn_cursor_op(session); - WT_ERR(__cursor_row_search(session, cbt, cbt->ref, 1)); + WT_ERR(__cursor_row_search(session, cbt, cbt->ref, true)); /* * Search-near is trickier than search when searching an already @@ -414,7 +415,7 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) if (!valid) { WT_ERR(__cursor_func_init(cbt, 1)); WT_ERR(btree->type == BTREE_ROW ? - __cursor_row_search(session, cbt, NULL, 1) : + __cursor_row_search(session, cbt, NULL, true) : __cursor_col_search(session, cbt, NULL)); valid = __cursor_valid(cbt, &upd); } @@ -445,16 +446,16 @@ __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp) cursor->value.data = &cbt->v; cursor->value.size = 1; exact = 0; - } else if ((ret = __wt_btcur_next(cbt, 0)) != WT_NOTFOUND) + } else if ((ret = __wt_btcur_next(cbt, false)) != WT_NOTFOUND) exact = 1; else { WT_ERR(btree->type == BTREE_ROW ? - __cursor_row_search(session, cbt, NULL, 1) : + __cursor_row_search(session, cbt, NULL, true) : __cursor_col_search(session, cbt, NULL)); if (__cursor_valid(cbt, &upd)) { exact = cbt->compare; ret = __wt_kv_return(session, cbt, upd); - } else if ((ret = __wt_btcur_prev(cbt, 0)) != WT_NOTFOUND) + } else if ((ret = __wt_btcur_prev(cbt, false)) != WT_NOTFOUND) exact = -1; } @@ -495,8 +496,8 @@ __wt_btcur_insert(WT_CURSOR_BTREE *cbt) * and it's no longer possible to bulk-load into it. */ if (btree->bulk_load_ok) { - btree->bulk_load_ok = 0; - __wt_btree_evictable(session, 1); + btree->bulk_load_ok = false; + __wt_btree_evictable(session, true); } retry: WT_RET(__cursor_func_init(cbt, 1)); @@ -530,12 +531,12 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); (cbt->compare != 0 && __cursor_fix_implicit(btree, cbt)))) WT_ERR(WT_DUPLICATE_KEY); - WT_ERR(__cursor_col_modify(session, cbt, 0)); + WT_ERR(__cursor_col_modify(session, cbt, false)); if (F_ISSET(cursor, WT_CURSTD_APPEND)) cbt->iface.recno = cbt->recno; break; case BTREE_ROW: - WT_ERR(__cursor_row_search(session, cbt, NULL, 1)); + WT_ERR(__cursor_row_search(session, cbt, NULL, true)); /* * If not overwriting, fail if the key exists, else insert the * key/value pair. @@ -544,7 +545,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); cbt->compare == 0 && __cursor_valid(cbt, NULL)) WT_ERR(WT_DUPLICATE_KEY); - ret = __cursor_row_modify(session, cbt, 0); + ret = __cursor_row_modify(session, cbt, false); break; WT_ILLEGAL_VALUE_ERR(session); } @@ -615,7 +616,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); switch (btree->type) { case BTREE_ROW: - WT_ERR(__cursor_row_search(session, cbt, NULL, 1)); + WT_ERR(__cursor_row_search(session, cbt, NULL, true)); /* * Just check for conflicts. @@ -691,11 +692,11 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); */ cbt->recno = cursor->recno; } else - ret = __cursor_col_modify(session, cbt, 1); + ret = __cursor_col_modify(session, cbt, true); break; case BTREE_ROW: /* Remove the record if it exists. */ - WT_ERR(__cursor_row_search(session, cbt, NULL, 0)); + WT_ERR(__cursor_row_search(session, cbt, NULL, false)); /* Check whether an update would conflict. */ WT_ERR(__curfile_update_check(cbt)); @@ -703,7 +704,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); if (cbt->compare != 0 || !__cursor_valid(cbt, NULL)) WT_ERR(WT_NOTFOUND); - ret = __cursor_row_modify(session, cbt, 1); + ret = __cursor_row_modify(session, cbt, true); break; WT_ILLEGAL_VALUE_ERR(session); } @@ -756,8 +757,8 @@ __wt_btcur_update(WT_CURSOR_BTREE *cbt) * and it's no longer possible to bulk-load into it. */ if (btree->bulk_load_ok) { - btree->bulk_load_ok = 0; - __wt_btree_evictable(session, 1); + btree->bulk_load_ok = false; + __wt_btree_evictable(session, true); } retry: WT_RET(__cursor_func_init(cbt, 1)); @@ -781,10 +782,10 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); !__cursor_fix_implicit(btree, cbt)) WT_ERR(WT_NOTFOUND); } - ret = __cursor_col_modify(session, cbt, 0); + ret = __cursor_col_modify(session, cbt, false); break; case BTREE_ROW: - WT_ERR(__cursor_row_search(session, cbt, NULL, 1)); + WT_ERR(__cursor_row_search(session, cbt, NULL, true)); /* * If not overwriting, check for conflicts and fail if the key * does not exist. @@ -794,7 +795,7 @@ retry: WT_RET(__cursor_func_init(cbt, 1)); if (cbt->compare != 0 || !__cursor_valid(cbt, NULL)) WT_ERR(WT_NOTFOUND); } - ret = __cursor_row_modify(session, cbt, 0); + ret = __cursor_row_modify(session, cbt, false); break; WT_ILLEGAL_VALUE_ERR(session); } @@ -854,8 +855,8 @@ __wt_btcur_next_random(WT_CURSOR_BTREE *cbt) if (__cursor_valid(cbt, &upd)) WT_ERR(__wt_kv_return(session, cbt, upd)); else { - if ((ret = __wt_btcur_next(cbt, 0)) == WT_NOTFOUND) - ret = __wt_btcur_prev(cbt, 0); + if ((ret = __wt_btcur_next(cbt, false)) == WT_NOTFOUND) + ret = __wt_btcur_prev(cbt, false); WT_ERR(ret); } @@ -945,8 +946,7 @@ __cursor_equals(WT_CURSOR_BTREE *a, WT_CURSOR_BTREE *b) * Return an equality comparison between two cursors. */ int -__wt_btcur_equals( - WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp) +__wt_btcur_equals(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp) { WT_CURSOR *a, *b; WT_SESSION_IMPL *session; @@ -985,7 +985,7 @@ __wt_btcur_equals( static int __cursor_truncate(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop, - int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, int)) + int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool)) { WT_DECL_RET; @@ -1014,7 +1014,7 @@ retry: WT_RET(__wt_btcur_remove(start)); for (ret = 0;;) { if (stop != NULL && __cursor_equals(start, stop)) break; - if ((ret = __wt_btcur_next(start, 1)) != 0) + if ((ret = __wt_btcur_next(start, true)) != 0) break; start->compare = 0; /* Exact match */ if ((ret = rmfunc(session, start, 1)) != 0) @@ -1038,7 +1038,7 @@ retry: WT_RET(__wt_btcur_remove(start)); static int __cursor_truncate_fix(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop, - int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, int)) + int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool)) { WT_DECL_RET; uint8_t *value; @@ -1067,7 +1067,7 @@ retry: WT_RET(__wt_btcur_remove(start)); for (ret = 0;;) { if (stop != NULL && __cursor_equals(start, stop)) break; - if ((ret = __wt_btcur_next(start, 1)) != 0) + if ((ret = __wt_btcur_next(start, true)) != 0) break; start->compare = 0; /* Exact match */ value = (uint8_t *)start->iface.value.data; @@ -1181,7 +1181,7 @@ __wt_btcur_open(WT_CURSOR_BTREE *cbt) * Close a btree cursor. */ int -__wt_btcur_close(WT_CURSOR_BTREE *cbt, int lowlevel) +__wt_btcur_close(WT_CURSOR_BTREE *cbt, bool lowlevel) { WT_DECL_RET; WT_SESSION_IMPL *session; diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index 371d5ec1565..4d3add47052 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -31,7 +31,7 @@ static const /* Output separator */ static int __debug_cell(WT_DBG *, const WT_PAGE_HEADER *, WT_CELL_UNPACK *); static int __debug_cell_data( WT_DBG *, WT_PAGE *, int type, const char *, WT_CELL_UNPACK *); -static void __debug_col_skip(WT_DBG *, WT_INSERT_HEAD *, const char *, int); +static void __debug_col_skip(WT_DBG *, WT_INSERT_HEAD *, const char *, bool); static int __debug_config(WT_SESSION_IMPL *, WT_DBG *, const char *); static int __debug_dsk_cell(WT_DBG *, const WT_PAGE_HEADER *); static void __debug_dsk_col_fix(WT_DBG *, const WT_PAGE_HEADER *); @@ -46,7 +46,7 @@ static int __debug_page_row_leaf(WT_DBG *, WT_PAGE *); static int __debug_ref(WT_DBG *, WT_REF *); static void __debug_row_skip(WT_DBG *, WT_INSERT_HEAD *); static int __debug_tree(WT_SESSION_IMPL *, WT_PAGE *, const char *, uint32_t); -static void __debug_update(WT_DBG *, WT_UPDATE *, int); +static void __debug_update(WT_DBG *, WT_UPDATE *, bool); static void __dmsg(WT_DBG *, const char *, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 2, 3))); static void __dmsg_wrapup(WT_DBG *); @@ -707,7 +707,7 @@ __debug_page_col_fix(WT_DBG *ds, WT_PAGE *page) __dmsg(ds, "\tupdate %" PRIu64 "\n", WT_INSERT_RECNO(ins)); - __debug_update(ds, ins->upd, 1); + __debug_update(ds, ins->upd, true); ins = WT_SKIP_NEXT(ins); } ++recno; @@ -716,11 +716,12 @@ __debug_page_col_fix(WT_DBG *ds, WT_PAGE *page) if (WT_COL_UPDATE_SINGLE(page) != NULL) { __dmsg(ds, "%s", sep); - __debug_col_skip(ds, WT_COL_UPDATE_SINGLE(page), "update", 1); + __debug_col_skip( + ds, WT_COL_UPDATE_SINGLE(page), "update", true); } if (WT_COL_APPEND(page) != NULL) { __dmsg(ds, "%s", sep); - __debug_col_skip(ds, WT_COL_APPEND(page), "append", 1); + __debug_col_skip(ds, WT_COL_APPEND(page), "append", true); } } @@ -783,13 +784,13 @@ __debug_page_col_var(WT_DBG *ds, WT_PAGE *page) __debug_cell_data(ds, page, WT_PAGE_COL_VAR, tag, unpack)); if ((update = WT_COL_UPDATE(page, cip)) != NULL) - __debug_col_skip(ds, update, "update", 0); + __debug_col_skip(ds, update, "update", false); recno += rle; } if (WT_COL_APPEND(page) != NULL) { __dmsg(ds, "%s", sep); - __debug_col_skip(ds, WT_COL_APPEND(page), "append", 0); + __debug_col_skip(ds, WT_COL_APPEND(page), "append", false); } return (0); @@ -855,7 +856,7 @@ __debug_page_row_leaf(WT_DBG *ds, WT_PAGE *page) /* Dump the page's K/V pairs. */ WT_ROW_FOREACH(page, rip, i) { - WT_RET(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_RET(__wt_row_leaf_key(session, page, rip, key, false)); __debug_item(ds, "K", key->data, key->size); if ((cell = __wt_row_leaf_value_cell(page, rip, NULL)) == NULL) @@ -867,7 +868,7 @@ __debug_page_row_leaf(WT_DBG *ds, WT_PAGE *page) } if ((upd = WT_ROW_UPDATE(page, rip)) != NULL) - __debug_update(ds, upd, 0); + __debug_update(ds, upd, false); if ((insert = WT_ROW_INSERT(page, rip)) != NULL) __debug_row_skip(ds, insert); @@ -882,7 +883,8 @@ err: __wt_scr_free(session, &key); * Dump a column-store skiplist. */ static void -__debug_col_skip(WT_DBG *ds, WT_INSERT_HEAD *head, const char *tag, int hexbyte) +__debug_col_skip( + WT_DBG *ds, WT_INSERT_HEAD *head, const char *tag, bool hexbyte) { WT_INSERT *ins; @@ -905,7 +907,7 @@ __debug_row_skip(WT_DBG *ds, WT_INSERT_HEAD *head) WT_SKIP_FOREACH(ins, head) { __debug_item(ds, "insert", WT_INSERT_KEY(ins), WT_INSERT_KEY_SIZE(ins)); - __debug_update(ds, ins->upd, 0); + __debug_update(ds, ins->upd, false); } } @@ -914,7 +916,7 @@ __debug_row_skip(WT_DBG *ds, WT_INSERT_HEAD *head) * Dump an update list. */ static void -__debug_update(WT_DBG *ds, WT_UPDATE *upd, int hexbyte) +__debug_update(WT_DBG *ds, WT_UPDATE *upd, bool hexbyte) { for (; upd != NULL; upd = upd->next) if (WT_UPDATE_DELETED_ISSET(upd)) diff --git a/src/btree/bt_discard.c b/src/btree/bt_discard.c index 453a7fc4640..c27d42d38f4 100644 --- a/src/btree/bt_discard.c +++ b/src/btree/bt_discard.c @@ -209,7 +209,7 @@ __free_page_modify(WT_SESSION_IMPL *session, WT_PAGE *page) static void __free_page_int(WT_SESSION_IMPL *session, WT_PAGE *page) { - __wt_free_ref_index(session, page, WT_INTL_INDEX_GET_SAFE(page), 0); + __wt_free_ref_index(session, page, WT_INTL_INDEX_GET_SAFE(page), false); } /* @@ -219,7 +219,7 @@ __free_page_int(WT_SESSION_IMPL *session, WT_PAGE *page) */ void __wt_free_ref( - WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, int free_pages) + WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, bool free_pages) { WT_IKEY *ikey; @@ -268,7 +268,7 @@ __wt_free_ref( */ void __wt_free_ref_index(WT_SESSION_IMPL *session, - WT_PAGE *page, WT_PAGE_INDEX *pindex, int free_pages) + WT_PAGE *page, WT_PAGE_INDEX *pindex, bool free_pages) { uint32_t i; diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index 54bcf343b3b..9737c0c6c60 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -169,7 +169,7 @@ __wt_btree_close(WT_SESSION_IMPL *session) btree->collator = NULL; btree->kencryptor = NULL; - btree->bulk_load_ok = 0; + btree->bulk_load_ok = false; F_CLR(btree, WT_BTREE_SPECIAL_FLAGS); @@ -189,7 +189,7 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt) WT_DECL_RET; int64_t maj_version, min_version; uint32_t bitcnt; - int fixed; + bool fixed; const char **cfg, *enc_cfg[] = { NULL, NULL }; btree = S2BT(session); @@ -353,7 +353,7 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt) * Initialize a tree root reference, and link in the root page. */ void -__wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, int is_recno) +__wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, bool is_recno) { memset(root_ref, 0, sizeof(*root_ref)); @@ -465,8 +465,8 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, bool creation) * globally, there's no point in searching empty trees for eviction. */ if (creation) { - btree->bulk_load_ok = 1; - __wt_btree_evictable(session, 0); + btree->bulk_load_ok = true; + __wt_btree_evictable(session, false); } /* @@ -483,8 +483,8 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, bool creation) switch (btree->type) { case BTREE_COL_FIX: case BTREE_COL_VAR: - WT_ERR( - __wt_page_alloc(session, WT_PAGE_COL_INT, 1, 1, 1, &root)); + WT_ERR(__wt_page_alloc( + session, WT_PAGE_COL_INT, 1, 1, true, &root)); root->pg_intl_parent_ref = &btree->root; pindex = WT_INTL_INDEX_GET_SAFE(root); @@ -496,8 +496,8 @@ __btree_tree_open_empty(WT_SESSION_IMPL *session, bool creation) ref->key.recno = 1; break; case BTREE_ROW: - WT_ERR( - __wt_page_alloc(session, WT_PAGE_ROW_INT, 0, 1, 1, &root)); + WT_ERR(__wt_page_alloc( + session, WT_PAGE_ROW_INT, 0, 1, true, &root)); root->pg_intl_parent_ref = &btree->root; pindex = WT_INTL_INDEX_GET_SAFE(root); @@ -545,16 +545,16 @@ __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep) switch (btree->type) { case BTREE_COL_FIX: - WT_RET( - __wt_page_alloc(session, WT_PAGE_COL_FIX, 1, 0, 0, pagep)); + WT_RET(__wt_page_alloc( + session, WT_PAGE_COL_FIX, 1, 0, false, pagep)); break; case BTREE_COL_VAR: - WT_RET( - __wt_page_alloc(session, WT_PAGE_COL_VAR, 1, 0, 0, pagep)); + WT_RET(__wt_page_alloc( + session, WT_PAGE_COL_VAR, 1, 0, false, pagep)); break; case BTREE_ROW: - WT_RET( - __wt_page_alloc(session, WT_PAGE_ROW_LEAF, 0, 0, 0, pagep)); + WT_RET(__wt_page_alloc( + session, WT_PAGE_ROW_LEAF, 0, 0, false, pagep)); break; WT_ILLEGAL_VALUE(session); } @@ -566,7 +566,7 @@ __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep) * Setup or release a cache-resident tree. */ void -__wt_btree_evictable(WT_SESSION_IMPL *session, int on) +__wt_btree_evictable(WT_SESSION_IMPL *session, bool on) { WT_BTREE *btree; diff --git a/src/btree/bt_huffman.c b/src/btree/bt_huffman.c index 40141b9efbb..d9ff9616072 100644 --- a/src/btree/bt_huffman.c +++ b/src/btree/bt_huffman.c @@ -134,7 +134,7 @@ static int __wt_huffman_read(WT_SESSION_IMPL *, */ static int __huffman_confchk_file( - WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v, int *is_utf8p, FILE **fpp) + WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v, bool *is_utf8p, FILE **fpp) { FILE *fp; WT_DECL_RET; @@ -302,7 +302,7 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, WT_DECL_RET; int64_t symbol, frequency; u_int entries, lineno; - int is_utf8; + bool is_utf8; *tablep = NULL; *entriesp = *numbytesp = 0; diff --git a/src/btree/bt_ovfl.c b/src/btree/bt_ovfl.c index 7104e702418..651cbc8d4ad 100644 --- a/src/btree/bt_ovfl.c +++ b/src/btree/bt_ovfl.c @@ -154,7 +154,7 @@ int __wt_ovfl_cache(WT_SESSION_IMPL *session, WT_PAGE *page, void *cookie, WT_CELL_UNPACK *vpack) { - int visible; + bool visible; /* * This function solves a problem in reconciliation. The scenario is: diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index ba218fc332c..34964def54c 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -22,7 +22,7 @@ static int __inmem_row_leaf_entries( */ int __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, - uint64_t recno, uint32_t alloc_entries, int alloc_refs, WT_PAGE **pagep) + uint64_t recno, uint32_t alloc_entries, bool alloc_refs, WT_PAGE **pagep) { WT_CACHE *cache; WT_DECL_RET; @@ -192,7 +192,7 @@ __wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref, /* Allocate and initialize a new WT_PAGE. */ WT_RET(__wt_page_alloc( - session, dsk->type, dsk->recno, alloc_entries, 1, &page)); + session, dsk->type, dsk->recno, alloc_entries, true, &page)); page->dsk = dsk; F_SET_ATOMIC(page, flags); diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index d26b44e04c0..c2649b9babb 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -74,7 +74,7 @@ __col_instantiate(WT_SESSION_IMPL *session, { /* Search the page and add updates. */ WT_RET(__wt_col_search(session, recno, ref, cbt)); - WT_RET(__wt_col_modify(session, cbt, recno, NULL, upd, 0)); + WT_RET(__wt_col_modify(session, cbt, recno, NULL, upd, false)); return (0); } @@ -87,8 +87,8 @@ __row_instantiate(WT_SESSION_IMPL *session, WT_ITEM *key, WT_REF *ref, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd) { /* Search the page and add updates. */ - WT_RET(__wt_row_search(session, key, ref, cbt, 1)); - WT_RET(__wt_row_modify(session, cbt, key, NULL, upd, 0)); + WT_RET(__wt_row_search(session, key, ref, cbt, true)); + WT_RET(__wt_row_modify(session, cbt, key, NULL, upd, false)); return (0); } @@ -259,7 +259,7 @@ __las_page_instantiate(WT_SESSION_IMPL *session, } err: WT_TRET(__wt_las_cursor_close(session, &cursor, session_flags)); - WT_TRET(__wt_btcur_close(&cbt, 1)); + WT_TRET(__wt_btcur_close(&cbt, true)); /* * On error, upd points to a single unlinked WT_UPDATE structure, @@ -438,12 +438,13 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags WT_DECL_RET; WT_PAGE *page; u_int sleep_cnt, wait_cnt; - int busy, cache_work, force_attempts, oldgen, stalled; + bool busy, cache_work, oldgen, stalled; + int force_attempts; btree = S2BT(session); - stalled = 0; - for (force_attempts = oldgen = 0, sleep_cnt = wait_cnt = 0;;) { + for (oldgen = stalled = false, + force_attempts = 0, sleep_cnt = wait_cnt = 0;;) { switch (ref->state) { case WT_REF_DISK: case WT_REF_DELETED: @@ -470,7 +471,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags /* Waiting on another thread's read, stall. */ WT_STAT_FAST_CONN_INCR(session, page_read_blocked); - stalled = 1; + stalled = true; break; case WT_REF_LOCKED: if (LF_ISSET(WT_READ_NO_WAIT)) @@ -478,7 +479,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags /* Waiting on eviction, stall. */ WT_STAT_FAST_CONN_INCR(session, page_locked_blocked); - stalled = 1; + stalled = true; break; case WT_REF_SPLIT: return (WT_RESTART); @@ -533,7 +534,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags ret = 0; WT_STAT_FAST_CONN_INCR(session, page_forcible_evict_blocked); - stalled = 1; + stalled = true; break; } WT_RET(ret); diff --git a/src/btree/bt_ret.c b/src/btree/bt_ret.c index 5009a2096be..c7a4b8e22f4 100644 --- a/src/btree/bt_ret.c +++ b/src/btree/bt_ret.c @@ -99,7 +99,7 @@ __wt_kv_return(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_UPDATE *upd) cursor->key.size = cbt->row_key->size; } else WT_RET(__wt_row_leaf_key( - session, page, rip, &cursor->key, 0)); + session, page, rip, &cursor->key, false)); /* If the cursor references a WT_UPDATE item, return it. */ if (upd != NULL) { diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index 1de1c903b01..4f7fdc97f5f 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -32,7 +32,7 @@ struct __wt_stuff { uint8_t page_type; /* Page type */ /* If need to free blocks backing merged page ranges. */ - int merge_free; + bool merge_free; WT_ITEM *tmp1; /* Verbose print buffer */ WT_ITEM *tmp2; /* Verbose print buffer */ @@ -127,7 +127,7 @@ static int __slvg_merge_block_free(WT_SESSION_IMPL *, WT_STUFF *); static int WT_CDECL __slvg_ovfl_compare(const void *, const void *); static int __slvg_ovfl_discard(WT_SESSION_IMPL *, WT_STUFF *); static int __slvg_ovfl_reconcile(WT_SESSION_IMPL *, WT_STUFF *); -static int __slvg_ovfl_ref(WT_SESSION_IMPL *, WT_TRACK *, int); +static int __slvg_ovfl_ref(WT_SESSION_IMPL *, WT_TRACK *, bool); static int __slvg_ovfl_ref_all(WT_SESSION_IMPL *, WT_TRACK *); static int __slvg_read(WT_SESSION_IMPL *, WT_STUFF *); static int __slvg_row_build_internal(WT_SESSION_IMPL *, uint32_t, WT_STUFF *); @@ -143,7 +143,7 @@ static int __slvg_row_trk_update_start( static int WT_CDECL __slvg_trk_compare_addr(const void *, const void *); static int WT_CDECL __slvg_trk_compare_gen(const void *, const void *); static int WT_CDECL __slvg_trk_compare_key(const void *, const void *); -static int __slvg_trk_free(WT_SESSION_IMPL *, WT_TRACK **, int); +static int __slvg_trk_free(WT_SESSION_IMPL *, WT_TRACK **, bool); static void __slvg_trk_free_addr(WT_SESSION_IMPL *, WT_TRACK *); static int __slvg_trk_init(WT_SESSION_IMPL *, uint8_t *, size_t, uint32_t, uint64_t, WT_STUFF *, WT_TRACK **); @@ -988,8 +988,8 @@ delete_b: /* if (b_trk->shared->ref == 1) for (i = 0; i < b_trk->trk_ovfl_cnt; ++i) WT_RET(__slvg_trk_free(session, - &ss->ovfl[b_trk->trk_ovfl_slot[i]], 1)); - return (__slvg_trk_free(session, &ss->pages[b_slot], 1)); + &ss->ovfl[b_trk->trk_ovfl_slot[i]], true)); + return (__slvg_trk_free(session, &ss->pages[b_slot], true)); } /* @@ -1162,8 +1162,8 @@ __slvg_col_build_internal( addr = NULL; /* Allocate a column-store root (internal) page and fill it in. */ - WT_RET( - __wt_page_alloc(session, WT_PAGE_COL_INT, 1, leaf_cnt, 1, &page)); + WT_RET(__wt_page_alloc( + session, WT_PAGE_COL_INT, 1, leaf_cnt, true, &page)); WT_ERR(__slvg_modify_init(session, page)); pindex = WT_INTL_INDEX_GET_SAFE(page); @@ -1199,7 +1199,7 @@ __slvg_col_build_internal( * additional pass to free the merge page's backing blocks. */ if (F_ISSET(trk, WT_TRACK_MERGE)) { - ss->merge_free = 1; + ss->merge_free = true; WT_ERR(__slvg_col_build_leaf(session, trk, ref)); } else @@ -1207,7 +1207,7 @@ __slvg_col_build_internal( ++ref; } - __wt_root_ref_init(&ss->root_ref, page, 1); + __wt_root_ref_init(&ss->root_ref, page, true); if (0) { err: if (addr != NULL) @@ -1333,7 +1333,7 @@ __slvg_col_ovfl_single( ovfl = trk->ss->ovfl[trk->trk_ovfl_slot[i]]; if (unpack->size == ovfl->trk_addr_size && memcmp(unpack->data, ovfl->trk_addr, unpack->size) == 0) - return (__slvg_ovfl_ref(session, ovfl, 0)); + return (__slvg_ovfl_ref(session, ovfl, false)); } WT_PANIC_RET(session, @@ -1635,8 +1635,8 @@ delete_b: /* if (b_trk->shared->ref == 1) for (i = 0; i < b_trk->trk_ovfl_cnt; ++i) WT_RET(__slvg_trk_free(session, - &ss->ovfl[b_trk->trk_ovfl_slot[i]], 1)); - return (__slvg_trk_free(session, &ss->pages[b_slot], 1)); + &ss->ovfl[b_trk->trk_ovfl_slot[i]], true)); + return (__slvg_trk_free(session, &ss->pages[b_slot], true)); } /* @@ -1719,11 +1719,12 @@ __slvg_row_trk_update_start( WT_ROW *rip; WT_TRACK *trk; uint32_t i; - int cmp, found; + int cmp; + bool found; btree = S2BT(session); page = NULL; - found = 0; + found = false; trk = ss->pages[slot]; @@ -1757,10 +1758,10 @@ __slvg_row_trk_update_start( */ WT_ERR(__wt_scr_alloc(session, 0, &key)); WT_ROW_FOREACH(page, rip, i) { - WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_ERR(__wt_row_leaf_key(session, page, rip, key, false)); WT_ERR(__wt_compare(session, btree->collator, key, stop, &cmp)); if (cmp > 0) { - found = 1; + found = true; break; } } @@ -1821,8 +1822,8 @@ __slvg_row_build_internal( addr = NULL; /* Allocate a row-store root (internal) page and fill it in. */ - WT_RET( - __wt_page_alloc(session, WT_PAGE_ROW_INT, 0, leaf_cnt, 1, &page)); + WT_RET(__wt_page_alloc( + session, WT_PAGE_ROW_INT, 0, leaf_cnt, true, &page)); WT_ERR(__slvg_modify_init(session, page)); pindex = WT_INTL_INDEX_GET_SAFE(page); @@ -1858,7 +1859,7 @@ __slvg_row_build_internal( * additional pass to free the merge page's backing blocks. */ if (F_ISSET(trk, WT_TRACK_MERGE)) { - ss->merge_free = 1; + ss->merge_free = true; WT_ERR(__slvg_row_build_leaf(session, trk, ref, ss)); } else { @@ -1870,7 +1871,7 @@ __slvg_row_build_internal( ++ref; } - __wt_root_ref_init(&ss->root_ref, page, 0); + __wt_root_ref_init(&ss->root_ref, page, false); if (0) { err: if (addr != NULL) @@ -1928,7 +1929,8 @@ __slvg_row_build_leaf( skip_start = skip_stop = 0; if (F_ISSET(trk, WT_TRACK_CHECK_START)) WT_ROW_FOREACH(page, rip, i) { - WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_ERR( + __wt_row_leaf_key(session, page, rip, key, false)); /* * >= is correct: see the comment above. @@ -1951,7 +1953,8 @@ __slvg_row_build_leaf( } if (F_ISSET(trk, WT_TRACK_CHECK_STOP)) WT_ROW_FOREACH_REVERSE(page, rip, i) { - WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_ERR( + __wt_row_leaf_key(session, page, rip, key, false)); /* * < is correct: see the comment above. @@ -1984,7 +1987,7 @@ __slvg_row_build_leaf( * a copy from the page. */ rip = page->pg_row_d + skip_start; - WT_ERR(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_ERR(__wt_row_leaf_key(session, page, rip, key, false)); WT_ERR(__wt_row_ikey_incr( session, ref->home, 0, key->data, key->size, ref)); @@ -2063,7 +2066,7 @@ __slvg_row_ovfl_single(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_CELL *cell) ovfl = trk->ss->ovfl[trk->trk_ovfl_slot[i]]; if (unpack.size == ovfl->trk_addr_size && memcmp(unpack.data, ovfl->trk_addr, unpack.size) == 0) - return (__slvg_ovfl_ref(session, ovfl, 1)); + return (__slvg_ovfl_ref(session, ovfl, true)); } WT_PANIC_RET(session, @@ -2223,7 +2226,7 @@ __slvg_ovfl_reconcile(WT_SESSION_IMPL *session, WT_STUFF *ss) while (j > 0) F_CLR(ss->ovfl[slot[--j]], WT_TRACK_OVFL_REFD); trk = NULL; - WT_ERR(__slvg_trk_free(session, &ss->pages[i], 1)); + WT_ERR(__slvg_trk_free(session, &ss->pages[i], true)); break; } @@ -2342,7 +2345,7 @@ __slvg_merge_block_free(WT_SESSION_IMPL *session, WT_STUFF *ss) if ((trk = ss->pages[i]) == NULL) continue; if (F_ISSET(trk, WT_TRACK_MERGE)) - WT_RET(__slvg_trk_free(session, &ss->pages[i], 1)); + WT_RET(__slvg_trk_free(session, &ss->pages[i], true)); } /* Free any unused overflow records. */ @@ -2354,7 +2357,7 @@ __slvg_merge_block_free(WT_SESSION_IMPL *session, WT_STUFF *ss) * Reference an overflow page, checking for multiple references. */ static int -__slvg_ovfl_ref(WT_SESSION_IMPL *session, WT_TRACK *trk, int multi_panic) +__slvg_ovfl_ref(WT_SESSION_IMPL *session, WT_TRACK *trk, bool multi_panic) { if (F_ISSET(trk, WT_TRACK_OVFL_REFD)) { if (!multi_panic) @@ -2413,7 +2416,7 @@ __slvg_ovfl_discard(WT_SESSION_IMPL *session, WT_STUFF *ss) "%s unused overflow page", __wt_addr_string( session, trk->trk_addr, trk->trk_addr_size, ss->tmp1))); - WT_RET(__slvg_trk_free(session, &ss->ovfl[i], 1)); + WT_RET(__slvg_trk_free(session, &ss->ovfl[i], true)); } return (0); @@ -2431,13 +2434,13 @@ __slvg_cleanup(WT_SESSION_IMPL *session, WT_STUFF *ss) /* Discard the leaf page array. */ for (i = 0; i < ss->pages_next; ++i) if (ss->pages[i] != NULL) - WT_RET(__slvg_trk_free(session, &ss->pages[i], 0)); + WT_RET(__slvg_trk_free(session, &ss->pages[i], false)); __wt_free(session, ss->pages); /* Discard the ovfl page array. */ for (i = 0; i < ss->ovfl_next; ++i) if (ss->ovfl[i] != NULL) - WT_RET(__slvg_trk_free(session, &ss->ovfl[i], 0)); + WT_RET(__slvg_trk_free(session, &ss->ovfl[i], false)); __wt_free(session, ss->ovfl); return (0); @@ -2487,7 +2490,8 @@ __slvg_trk_free_block(WT_SESSION_IMPL *session, WT_TRACK *trk) * Discard a WT_TRACK structure and (optionally) its underlying blocks. */ static int -__slvg_trk_free(WT_SESSION_IMPL *session, WT_TRACK **trkp, int free_on_last_ref) +__slvg_trk_free( + WT_SESSION_IMPL *session, WT_TRACK **trkp, bool free_on_last_ref) { WT_TRACK *trk; diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 9574ae80af8..8843cf7baa7 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -337,7 +337,8 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page) WT_ITEM *next, _next, *last, _last, *tmp; WT_REF *ref; uint64_t recno; - int cmp, first; + int cmp; + bool first; btree = S2BT(session); @@ -355,12 +356,12 @@ __split_verify_intl_key_order(WT_SESSION_IMPL *session, WT_PAGE *page) last = &_last; WT_CLEAR(_last); - first = 1; + first = true; WT_INTL_FOREACH_BEGIN(session, page, ref) { __wt_ref_key(page, ref, &next->data, &next->size); if (last->size == 0) { if (first) - first = 0; + first = false; else { WT_ASSERT(session, __wt_compare( session, btree->collator, last, @@ -394,7 +395,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent) uint64_t split_gen; uint32_t children, chunk, i, j, moved_entries, new_entries, remain; uint32_t skip_leading, slots; - int panic; + bool panic; void *p; WT_STAT_FAST_CONN_INCR(session, cache_eviction_deepen); @@ -403,7 +404,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent) btree = S2BT(session); alloc_index = NULL; parent_incr = parent_decr = 0; - panic = 0; + panic = false; /* * Our caller is holding the parent page locked to single-thread splits, @@ -485,7 +486,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent) i = 0; i < children; ++i) { slots = i == children - 1 ? remain : chunk; WT_ERR(__wt_page_alloc( - session, parent->type, 0, slots, 0, &child)); + session, parent->type, 0, slots, false, &child)); /* * Initialize the parent page's child reference; we need a copy @@ -562,7 +563,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent) WT_ASSERT(session, WT_INTL_INDEX_GET_SAFE(parent) == pindex); WT_INTL_INDEX_SET(parent, alloc_index); split_gen = __wt_atomic_addv64(&S2C(session)->split_gen, 1); - panic = 1; + panic = true; #ifdef HAVE_DIAGNOSTIC WT_WITH_PAGE_INDEX(session, @@ -656,7 +657,7 @@ __split_deepen(WT_SESSION_IMPL *session, WT_PAGE *parent) __wt_cache_page_inmem_decr(session, parent, parent_decr); if (0) { -err: __wt_free_ref_index(session, parent, alloc_index, 1); +err: __wt_free_ref_index(session, parent, alloc_index, true); /* * If panic is set, we saw an error after opening up the tree @@ -724,7 +725,7 @@ __split_multi_inmem( /* Apply the modification. */ WT_ERR(__wt_col_modify( - session, &cbt, recno, NULL, upd, 0)); + session, &cbt, recno, NULL, upd, false)); break; case WT_PAGE_ROW_LEAF: /* Build a key. */ @@ -734,7 +735,7 @@ __split_multi_inmem( orig->pg_row_upd[slot] = NULL; WT_ERR(__wt_row_leaf_key( - session, orig, supd->rip, key, 0)); + session, orig, supd->rip, key, false)); } else { upd = supd->ins->upd; supd->ins->upd = NULL; @@ -744,11 +745,11 @@ __split_multi_inmem( } /* Search the page. */ - WT_ERR(__wt_row_search(session, key, ref, &cbt, 1)); + WT_ERR(__wt_row_search(session, key, ref, &cbt, true)); /* Apply the modification. */ - WT_ERR( - __wt_row_modify(session, &cbt, key, NULL, upd, 0)); + WT_ERR(__wt_row_modify( + session, &cbt, key, NULL, upd, false)); break; WT_ILLEGAL_VALUE_ERR(session); } @@ -763,7 +764,7 @@ __split_multi_inmem( page->modify->first_dirty_txn = WT_TXN_FIRST; err: /* Free any resources that may have been cached in the cursor. */ - WT_TRET(__wt_btcur_close(&cbt, 1)); + WT_TRET(__wt_btcur_close(&cbt, true)); __wt_scr_free(session, &key); return (ret); @@ -856,14 +857,14 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, uint64_t split_gen; uint32_t i, j; uint32_t deleted_entries, parent_entries, result_entries; - int complete, hazard; + bool complete, hazard; parent = NULL; /* -Wconditional-uninitialized */ alloc_index = pindex = NULL; parent_ref = NULL; parent_decr = 0; parent_entries = 0; - complete = hazard = 0; + complete = hazard = false; /* * Get a page-level lock on the parent to single-thread splits into the @@ -924,7 +925,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, */ if (!__wt_ref_is_root(parent_ref = parent->pg_intl_parent_ref)) { WT_ERR(__wt_page_in(session, parent_ref, WT_READ_NO_EVICT)); - hazard = 1; + hazard = true; } /* @@ -1033,7 +1034,7 @@ __split_parent(WT_SESSION_IMPL *session, WT_REF *ref, * split is OK and complete. For those reasons, we ignore errors past * this point unless there's a panic. */ - complete = 1; + complete = true; WT_ERR(__wt_verbose(session, WT_VERB_SPLIT, "%s split into parent %" PRIu32 " -> %" PRIu32 @@ -1142,7 +1143,7 @@ err: if (!complete) if (hazard) WT_TRET(__wt_hazard_clear(session, parent)); - __wt_free_ref_index(session, NULL, alloc_index, 0); + __wt_free_ref_index(session, NULL, alloc_index, false); /* * A note on error handling: if we completed the split, return success, @@ -1229,7 +1230,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref) key->size = WT_INSERT_KEY_SIZE(ins); } else WT_ERR(__wt_row_leaf_key( - session, page, &page->pg_row_d[0], key, 1)); + session, page, &page->pg_row_d[0], key, true)); WT_ERR(__wt_row_ikey(session, 0, key->data, key->size, child)); parent_incr += sizeof(WT_REF) + sizeof(WT_IKEY) + key->size; __wt_scr_free(session, &key); @@ -1237,7 +1238,7 @@ __wt_split_insert(WT_SESSION_IMPL *session, WT_REF *ref) /* * The second page in the split is a new WT_REF/page pair. */ - WT_ERR(__wt_page_alloc(session, WT_PAGE_ROW_LEAF, 0, 0, 0, &right)); + WT_ERR(__wt_page_alloc(session, WT_PAGE_ROW_LEAF, 0, 0, false, &right)); WT_ERR(__wt_calloc_one(session, &right->pg_row_ins)); WT_ERR(__wt_calloc_one(session, &right->pg_row_ins[0])); right_incr += sizeof(WT_INSERT_HEAD); @@ -1533,7 +1534,7 @@ err: /* * For now, leak the memory by not discarding the instantiated pages. */ for (i = 0; i < new_entries; ++i) - __wt_free_ref(session, page, ref_new[i], 0); + __wt_free_ref(session, page, ref_new[i], false); __wt_free(session, ref_new); return (ret); } diff --git a/src/btree/bt_stat.c b/src/btree/bt_stat.c index b379712f6e7..2f8759b9d82 100644 --- a/src/btree/bt_stat.c +++ b/src/btree/bt_stat.c @@ -117,7 +117,7 @@ __stat_page_col_var( WT_UPDATE *upd; uint64_t deleted_cnt, entry_cnt, ovfl_cnt, rle_cnt; uint32_t i; - int orig_deleted; + bool orig_deleted; unpack = &_unpack; deleted_cnt = entry_cnt = ovfl_cnt = rle_cnt = 0; @@ -134,13 +134,13 @@ __stat_page_col_var( */ WT_COL_FOREACH(page, cip, i) { if ((cell = WT_COL_PTR(page, cip)) == NULL) { - orig_deleted = 1; + orig_deleted = true; ++deleted_cnt; } else { - orig_deleted = 0; + orig_deleted = false; __wt_cell_unpack(cell, unpack); if (unpack->type == WT_CELL_ADDR_DEL) - orig_deleted = 1; + orig_deleted = true; else { entry_cnt += __wt_cell_rle(unpack); rle_cnt += __wt_cell_rle(unpack) - 1; diff --git a/src/btree/bt_sync.c b/src/btree/bt_sync.c index a268cc77f03..5cbdb7de9bb 100644 --- a/src/btree/bt_sync.c +++ b/src/btree/bt_sync.c @@ -25,7 +25,7 @@ __sync_file(WT_SESSION_IMPL *session, int syncop) uint64_t internal_bytes, leaf_bytes; uint64_t internal_pages, leaf_pages; uint32_t flags; - int evict_reset; + bool evict_reset; btree = S2BT(session); diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 4491f096438..d745210bdce 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -23,10 +23,10 @@ typedef struct { #define WT_VRFY_DUMP(vs) \ ((vs)->dump_address || \ (vs)->dump_blocks || (vs)->dump_pages || (vs)->dump_shape) - int dump_address; /* Configure: dump special */ - int dump_blocks; - int dump_pages; - int dump_shape; + bool dump_address; /* Configure: dump special */ + bool dump_blocks; + bool dump_pages; + bool dump_shape; u_int depth, depth_internal[100], depth_leaf[100]; @@ -38,7 +38,7 @@ static void __verify_checkpoint_reset(WT_VSTUFF *); static int __verify_overflow( WT_SESSION_IMPL *, const uint8_t *, size_t, WT_VSTUFF *); static int __verify_overflow_cell( - WT_SESSION_IMPL *, WT_REF *, int *, WT_VSTUFF *); + WT_SESSION_IMPL *, WT_REF *, bool *, WT_VSTUFF *); static int __verify_row_int_key_order( WT_SESSION_IMPL *, WT_PAGE *, WT_REF *, uint32_t, WT_VSTUFF *); static int __verify_row_leaf_key_order( @@ -79,14 +79,15 @@ __verify_config(WT_SESSION_IMPL *session, const char *cfg[], WT_VSTUFF *vs) * Debugging: optionally dump specific blocks from the file. */ static int -__verify_config_offsets(WT_SESSION_IMPL *session, const char *cfg[], int *quitp) +__verify_config_offsets( + WT_SESSION_IMPL *session, const char *cfg[], bool *quitp) { WT_CONFIG list; WT_CONFIG_ITEM cval, k, v; WT_DECL_RET; u_long offset; - *quitp = 0; + *quitp = false; WT_RET(__wt_config_gets(session, cfg, "dump_offsets", &cval)); WT_RET(__wt_config_subinit(session, &list, &cval)); @@ -96,7 +97,7 @@ __verify_config_offsets(WT_SESSION_IMPL *session, const char *cfg[], int *quitp) * what the user wanted, all of this stuff is just hooked into * verify because that's where we "dump blocks" for debugging.) */ - *quitp = 1; + *quitp = true; if (v.len != 0 || sscanf(k.str, "%lu", &offset) != 1) WT_RET_MSG(session, EINVAL, "unexpected dump offset format"); @@ -156,12 +157,12 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) WT_VSTUFF *vs, _vstuff; size_t root_addr_size; uint8_t root_addr[WT_BTREE_MAX_ADDR_COOKIE]; - int bm_start, quit; + bool bm_start, quit; btree = S2BT(session); bm = btree->bm; ckptbase = NULL; - bm_start = 0; + bm_start = false; WT_CLEAR(_vstuff); vs = &_vstuff; @@ -184,7 +185,7 @@ __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]) /* Inform the underlying block manager we're verifying. */ WT_ERR(bm->verify_start(bm, session, ckptbase, cfg)); - bm_start = 1; + bm_start = true; /* Loop through the file's checkpoints, verifying each one. */ WT_CKPT_FOREACH(ckptbase, ckpt) { @@ -293,7 +294,7 @@ __verify_tree(WT_SESSION_IMPL *session, WT_REF *ref, WT_VSTUFF *vs) WT_REF *child_ref; uint64_t recno; uint32_t entry, i; - int found; + bool found; bm = S2BT(session)->bm; page = ref->page; @@ -648,7 +649,7 @@ __verify_row_leaf_key_order( */ static int __verify_overflow_cell( - WT_SESSION_IMPL *session, WT_REF *ref, int *found, WT_VSTUFF *vs) + WT_SESSION_IMPL *session, WT_REF *ref, bool *found, WT_VSTUFF *vs) { WT_BTREE *btree; WT_CELL *cell; @@ -659,7 +660,7 @@ __verify_overflow_cell( btree = S2BT(session); unpack = &_unpack; - *found = 0; + *found = false; /* * If a tree is empty (just created), it won't have a disk image; @@ -676,7 +677,7 @@ __verify_overflow_cell( switch (unpack->type) { case WT_CELL_KEY_OVFL: case WT_CELL_VALUE_OVFL: - *found = 1; + *found = true; WT_ERR(__verify_overflow( session, unpack->data, unpack->size, vs)); break; diff --git a/src/btree/bt_vrfy_dsk.c b/src/btree/bt_vrfy_dsk.c index cf86ca9bec3..a703fbd540d 100644 --- a/src/btree/bt_vrfy_dsk.c +++ b/src/btree/bt_vrfy_dsk.c @@ -43,7 +43,7 @@ static int __verify_dsk_row( */ int __wt_verify_dsk_image(WT_SESSION_IMPL *session, - const char *tag, const WT_PAGE_HEADER *dsk, size_t size, int empty_page_ok) + const char *tag, const WT_PAGE_HEADER *dsk, size_t size, bool empty_page_ok) { const uint8_t *p, *end; u_int i; @@ -178,7 +178,8 @@ __wt_verify_dsk_image(WT_SESSION_IMPL *session, int __wt_verify_dsk(WT_SESSION_IMPL *session, const char *tag, WT_ITEM *buf) { - return (__wt_verify_dsk_image(session, tag, buf->data, buf->size, 0)); + return ( + __wt_verify_dsk_image(session, tag, buf->data, buf->size, false)); } /* @@ -545,7 +546,7 @@ __verify_dsk_col_var( WT_DECL_RET; size_t last_size; uint32_t cell_num, cell_type, i; - int last_deleted; + bool last_deleted; const uint8_t *last_data; uint8_t *end; @@ -556,7 +557,7 @@ __verify_dsk_col_var( last_data = NULL; last_size = 0; - last_deleted = 0; + last_deleted = false; cell_num = 0; WT_CELL_FOREACH(btree, dsk, cell, unpack, i) { @@ -588,7 +589,7 @@ __verify_dsk_col_var( * a chance for RLE encoding. We don't have to care about data * encoding or anything else, a byte comparison is enough. */ - if (last_deleted == 1) { + if (last_deleted) { if (cell_type == WT_CELL_DEL) goto match_err; } else @@ -604,15 +605,15 @@ match_err: WT_RET_VRFY(session, switch (cell_type) { case WT_CELL_DEL: - last_deleted = 1; + last_deleted = true; last_data = NULL; break; case WT_CELL_VALUE_OVFL: - last_deleted = 0; + last_deleted = false; last_data = NULL; break; case WT_CELL_VALUE: - last_deleted = 0; + last_deleted = false; last_data = unpack->data; last_size = unpack->size; break; diff --git a/src/btree/col_modify.c b/src/btree/col_modify.c index cbc5143698b..bb2de3f444b 100644 --- a/src/btree/col_modify.c +++ b/src/btree/col_modify.c @@ -17,7 +17,7 @@ static int __col_insert_alloc( */ int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, - uint64_t recno, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove) + uint64_t recno, WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove) { WT_BTREE *btree; WT_DECL_RET; @@ -28,13 +28,13 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_UPDATE *old_upd, *upd; size_t ins_size, upd_size; u_int i, skipdepth; - int append, logged; + bool append, logged; btree = cbt->btree; ins = NULL; page = cbt->ref->page; upd = upd_arg; - append = logged = 0; + append = logged = false; /* This code expects a remove to have a NULL value. */ if (is_remove) { @@ -55,7 +55,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, if (recno == WT_RECNO_OOB || recno > (btree->type == BTREE_COL_VAR ? __col_var_last_recno(page) : __col_fix_last_recno(page))) - append = 1; + append = true; } /* If we don't yet have a modify structure, we'll need one. */ @@ -86,7 +86,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, /* Allocate a WT_UPDATE structure and transaction ID. */ WT_ERR(__wt_update_alloc(session, value, &upd, &upd_size)); WT_ERR(__wt_txn_modify(session, upd)); - logged = 1; + logged = true; /* Avoid a data copy in WT_CURSOR.update. */ cbt->modify_update = upd; @@ -139,7 +139,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ERR( __wt_update_alloc(session, value, &upd, &upd_size)); WT_ERR(__wt_txn_modify(session, upd)); - logged = 1; + logged = true; /* Avoid a data copy in WT_CURSOR.update. */ cbt->modify_update = upd; diff --git a/src/btree/row_key.c b/src/btree/row_key.c index 4affa7fa62a..6d24708e59c 100644 --- a/src/btree/row_key.c +++ b/src/btree/row_key.c @@ -61,7 +61,7 @@ __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page) for (rip = page->pg_row_d, i = 0; i < page->pg_row_entries; ++rip, ++i) if (__bit_test(tmp->mem, i)) WT_ERR(__wt_row_leaf_key_work( - session, page, rip, key, 1)); + session, page, rip, key, true)); F_SET_ATOMIC(page, WT_PAGE_BUILD_KEYS); @@ -112,7 +112,7 @@ int __wt_row_leaf_key_copy( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, WT_ITEM *key) { - WT_RET(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_RET(__wt_row_leaf_key(session, page, rip, key, false)); /* The return buffer may only hold a reference to a key, copy it. */ if (!WT_DATA_IN_ITEM(key)) @@ -128,7 +128,7 @@ __wt_row_leaf_key_copy( */ int __wt_row_leaf_key_work(WT_SESSION_IMPL *session, - WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, int instantiate) + WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, bool instantiate) { enum { FORWARD, BACKWARD } direction; WT_BTREE *btree; diff --git a/src/btree/row_modify.c b/src/btree/row_modify.c index 888c54d1ec9..0fc02948dd3 100644 --- a/src/btree/row_modify.c +++ b/src/btree/row_modify.c @@ -47,7 +47,7 @@ __wt_page_modify_alloc(WT_SESSION_IMPL *session, WT_PAGE *page) */ int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, - WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove) + WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove) { WT_DECL_RET; WT_INSERT *ins; @@ -57,12 +57,12 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, size_t ins_size, upd_size; uint32_t ins_slot; u_int i, skipdepth; - int logged; + bool logged; ins = NULL; page = cbt->ref->page; upd = upd_arg; - logged = 0; + logged = false; /* This code expects a remove to have a NULL value. */ if (is_remove) @@ -100,7 +100,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ERR( __wt_update_alloc(session, value, &upd, &upd_size)); WT_ERR(__wt_txn_modify(session, upd)); - logged = 1; + logged = true; /* Avoid WT_CURSOR.update data copy. */ cbt->modify_update = upd; @@ -171,7 +171,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ERR( __wt_update_alloc(session, value, &upd, &upd_size)); WT_ERR(__wt_txn_modify(session, upd)); - logged = 1; + logged = true; /* Avoid WT_CURSOR.update data copy. */ cbt->modify_update = upd; diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index 6f2856301a6..b99c93d319a 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -15,7 +15,7 @@ */ static inline int __wt_search_insert_append(WT_SESSION_IMPL *session, - WT_CURSOR_BTREE *cbt, WT_ITEM *srch_key, int *donep) + WT_CURSOR_BTREE *cbt, WT_ITEM *srch_key, bool *donep) { WT_BTREE *btree; WT_COLLATOR *collator; @@ -137,7 +137,7 @@ __wt_search_insert( */ int __wt_row_search(WT_SESSION_IMPL *session, - WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, int insert) + WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, bool insert) { WT_BTREE *btree; WT_COLLATOR *collator; @@ -149,7 +149,8 @@ __wt_row_search(WT_SESSION_IMPL *session, WT_ROW *rip; size_t match, skiphigh, skiplow; uint32_t base, indx, limit; - int append_check, cmp, depth, descend_right, done; + int cmp, depth; + bool append_check, descend_right, done; btree = S2BT(session); collator = btree->collator; @@ -176,7 +177,7 @@ __wt_row_search(WT_SESSION_IMPL *session, * the cursor's append history. */ append_check = insert && cbt->append_tree; - descend_right = 1; + descend_right = true; /* We may only be searching a single leaf page, not the full tree. */ if (leaf != NULL) { @@ -213,7 +214,7 @@ restart: page = current->page; goto descend; /* A failed append check turns off append checks. */ - append_check = 0; + append_check = false; } /* @@ -282,7 +283,7 @@ restart: page = current->page; * right-side descent. */ if (pindex->entries != base - 1) - descend_right = 0; + descend_right = false; descend: /* * Swap the current page for the child page. If the page splits @@ -365,7 +366,8 @@ leaf_only: for (; limit != 0; limit >>= 1) { indx = base + (limit >> 1); rip = page->pg_row_d + indx; - WT_ERR(__wt_row_leaf_key(session, page, rip, item, 1)); + WT_ERR( + __wt_row_leaf_key(session, page, rip, item, true)); match = WT_MIN(skiplow, skiphigh); cmp = __wt_lex_compare_skip(srch_key, item, &match); @@ -382,7 +384,8 @@ leaf_only: for (; limit != 0; limit >>= 1) { indx = base + (limit >> 1); rip = page->pg_row_d + indx; - WT_ERR(__wt_row_leaf_key(session, page, rip, item, 1)); + WT_ERR( + __wt_row_leaf_key(session, page, rip, item, true)); WT_ERR(__wt_compare( session, collator, srch_key, item, &cmp)); @@ -518,7 +521,7 @@ restart: * have to as well. */ return (__wt_row_leaf_key(session, - page, page->pg_row_d + cbt->slot, cbt->tmp, 0)); + page, page->pg_row_d + cbt->slot, cbt->tmp, false)); } /* diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c index 36f130dcfa4..58211eb33c5 100644 --- a/src/conn/conn_dhandle.c +++ b/src/conn/conn_dhandle.c @@ -125,7 +125,7 @@ __wt_conn_dhandle_find( static int __conn_dhandle_mark_dead(WT_SESSION_IMPL *session) { - int evict_reset; + bool evict_reset; /* * Handle forced discard (e.g., when dropping a file). diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index 8da32416242..925e1c68815 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -64,7 +64,7 @@ __sweep_expire_one(WT_SESSION_IMPL *session) WT_BTREE *btree; WT_DATA_HANDLE *dhandle; WT_DECL_RET; - int evict_reset; + bool evict_reset; btree = S2BT(session); dhandle = session->dhandle; diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index c998565eb75..8e95bb21340 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -110,7 +110,7 @@ __curfile_next(WT_CURSOR *cursor) CURSOR_API_CALL(cursor, session, next, cbt->btree); F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET); - if ((ret = __wt_btcur_next(cbt, 0)) == 0) + if ((ret = __wt_btcur_next(cbt, false)) == 0) F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); err: API_END_RET(session, ret); @@ -153,7 +153,7 @@ __curfile_prev(WT_CURSOR *cursor) CURSOR_API_CALL(cursor, session, prev, cbt->btree); F_CLR(cursor, WT_CURSTD_KEY_SET | WT_CURSTD_VALUE_SET); - if ((ret = __wt_btcur_prev(cbt, 0)) == 0) + if ((ret = __wt_btcur_prev(cbt, false)) == 0) F_SET(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT); err: API_END_RET(session, ret); @@ -369,7 +369,7 @@ __curfile_close(WT_CURSOR *cursor) __wt_buf_free(session, &cbulk->last); } - WT_TRET(__wt_btcur_close(cbt, 0)); + WT_TRET(__wt_btcur_close(cbt, false)); /* The URI is owned by the btree handle. */ cursor->internal_uri = NULL; WT_TRET(__wt_cursor_close(cursor)); diff --git a/src/evict/evict_file.c b/src/evict/evict_file.c index 66fabe48fb2..444cf80574f 100644 --- a/src/evict/evict_file.c +++ b/src/evict/evict_file.c @@ -18,7 +18,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, int syncop) WT_DECL_RET; WT_PAGE *page; WT_REF *next_ref, *ref; - int evict_reset; + bool evict_reset; /* * We need exclusive access to the file -- disable ordinary eviction diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index e0866521c7c..ff87130a455 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -701,7 +701,7 @@ __evict_clear_all_walks(WT_SESSION_IMPL *session) * blocks queued for eviction. */ int -__wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp) +__wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, bool *evict_resetp) { WT_BTREE *btree; WT_CACHE *cache; @@ -715,10 +715,10 @@ __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp) * If the file isn't evictable, there's no work to do. */ if (F_ISSET(btree, WT_BTREE_NO_EVICTION)) { - *evict_resetp = 0; + *evict_resetp = false; return (0); } - *evict_resetp = 1; + *evict_resetp = true; /* * Hold the walk lock to set the "no eviction" flag: no new pages from @@ -1447,14 +1447,15 @@ __evict_page(WT_SESSION_IMPL *session, int is_server) * crosses its boundaries. */ int -__wt_cache_eviction_worker(WT_SESSION_IMPL *session, int busy, u_int pct_full) +__wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, u_int pct_full) { WT_CACHE *cache; WT_CONNECTION_IMPL *conn; WT_DECL_RET; WT_TXN_GLOBAL *txn_global; WT_TXN_STATE *txn_state; - int count, q_found, txn_busy; + int count, q_found; + bool txn_busy; conn = S2C(session); cache = conn->cache; @@ -1478,7 +1479,7 @@ __wt_cache_eviction_worker(WT_SESSION_IMPL *session, int busy, u_int pct_full) if (txn_busy) { if (pct_full < 100) return (0); - busy = 1; + busy = true; } /* @@ -1536,8 +1537,10 @@ __wt_cache_eviction_worker(WT_SESSION_IMPL *session, int busy, u_int pct_full) cache->app_waits++; /* Check if things have changed so that we are busy. */ if (!busy && txn_state->snap_min != WT_TXN_NONE && - txn_global->current != txn_global->oldest_id) - busy = count = 1; + txn_global->current != txn_global->oldest_id) { + busy = true; + count = 1; + } } /* NOTREACHED */ } diff --git a/src/include/btree.h b/src/include/btree.h index 98ce4c22c10..1a749ce8c49 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -119,7 +119,7 @@ struct __wt_btree { WT_REF root; /* Root page reference */ int modified; /* If the tree ever modified */ - int bulk_load_ok; /* Bulk-load is a possibility */ + bool bulk_load_ok; /* Bulk-load is a possibility */ WT_BM *bm; /* Block manager reference */ u_int block_header; /* WT_PAGE_HEADER_BYTE_SIZE */ diff --git a/src/include/btree.i b/src/include/btree.i index d648fc7db58..b35a0cf37b1 100644 --- a/src/include/btree.i +++ b/src/include/btree.i @@ -791,7 +791,7 @@ __wt_row_leaf_value_set(WT_PAGE *page, WT_ROW *rip, WT_CELL_UNPACK *unpack) */ static inline int __wt_row_leaf_key(WT_SESSION_IMPL *session, - WT_PAGE *page, WT_ROW *rip, WT_ITEM *key, int instantiate) + WT_PAGE *page, WT_ROW *rip, WT_ITEM *key, bool instantiate) { void *copy; @@ -838,7 +838,7 @@ __wt_cursor_row_leaf_key(WT_CURSOR_BTREE *cbt, WT_ITEM *key) session = (WT_SESSION_IMPL *)cbt->iface.session; page = cbt->ref->page; rip = &page->u.row.d[cbt->slot]; - WT_RET(__wt_row_leaf_key(session, page, rip, key, 0)); + WT_RET(__wt_row_leaf_key(session, page, rip, key, false)); } else { key->data = WT_INSERT_KEY(cbt->ins); key->size = WT_INSERT_KEY_SIZE(cbt->ins); diff --git a/src/include/cache.i b/src/include/cache.i index 08562d3d869..475f4a86654 100644 --- a/src/include/cache.i +++ b/src/include/cache.i @@ -197,13 +197,13 @@ __wt_eviction_needed(WT_SESSION_IMPL *session, u_int *pct_fullp) * Evict pages if the cache crosses its boundaries. */ static inline int -__wt_cache_eviction_check(WT_SESSION_IMPL *session, int busy, int *didworkp) +__wt_cache_eviction_check(WT_SESSION_IMPL *session, bool busy, bool *didworkp) { WT_BTREE *btree; u_int pct_full; if (didworkp != NULL) - *didworkp = 0; + *didworkp = false; /* * LSM sets the no-cache-check flag when holding the LSM tree lock, in @@ -231,7 +231,7 @@ __wt_cache_eviction_check(WT_SESSION_IMPL *session, int busy, int *didworkp) * was no cache work to do. After this point, let them skip the sleep. */ if (didworkp != NULL) - *didworkp = 1; + *didworkp = true; return (__wt_cache_eviction_worker(session, busy, pct_full)); } diff --git a/src/include/cursor.i b/src/include/cursor.i index e7fed250251..d348e61be94 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -60,7 +60,7 @@ __cursor_enter(WT_SESSION_IMPL *session) * whether the cache is full. */ if (session->ncursors == 0) - WT_RET(__wt_cache_eviction_check(session, 0, NULL)); + WT_RET(__wt_cache_eviction_check(session, false, NULL)); ++session->ncursors; return (0); } @@ -296,7 +296,7 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip, WT_UPDATE *upd) * already did __wt_row_leaf_key's fast-path checks inline. */ slow: WT_RET(__wt_row_leaf_key_work( - session, page, rip, cbt->row_key, 0)); + session, page, rip, cbt->row_key, false)); } kb->data = cbt->row_key->data; kb->size = cbt->row_key->size; diff --git a/src/include/extern.h b/src/include/extern.h index 40b15ff1f8e..b5172dbcb0b 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -87,9 +87,9 @@ 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, bool *skipp); -extern void __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next); -extern int __wt_btcur_next(WT_CURSOR_BTREE *cbt, int truncating); -extern int __wt_btcur_prev(WT_CURSOR_BTREE *cbt, int truncating); +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); extern int __wt_btcur_reset(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_search(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exactp); @@ -99,11 +99,11 @@ extern int __wt_btcur_remove(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_update(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_next_random(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_compare(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp); -extern int __wt_btcur_equals( WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp); +extern int __wt_btcur_equals(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp); extern int __wt_btcur_range_truncate(WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop); extern void __wt_btcur_init(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt); extern void __wt_btcur_open(WT_CURSOR_BTREE *cbt); -extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt, int lowlevel); +extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt, bool lowlevel); extern int __wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v); extern int __wt_debug_addr_print( WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size); extern int __wt_debug_addr(WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size, const char *ofile); @@ -120,15 +120,15 @@ 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); extern void __wt_ref_out(WT_SESSION_IMPL *session, WT_REF *ref); extern void __wt_page_out(WT_SESSION_IMPL *session, WT_PAGE **pagep); -extern void __wt_free_ref( WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, int free_pages); -extern void __wt_free_ref_index(WT_SESSION_IMPL *session, WT_PAGE *page, WT_PAGE_INDEX *pindex, int free_pages); +extern void __wt_free_ref( WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref, bool free_pages); +extern void __wt_free_ref_index(WT_SESSION_IMPL *session, WT_PAGE *page, WT_PAGE_INDEX *pindex, bool free_pages); extern void __wt_free_update_list(WT_SESSION_IMPL *session, WT_UPDATE *upd); extern int __wt_btree_open(WT_SESSION_IMPL *session, const char *op_cfg[]); extern int __wt_btree_close(WT_SESSION_IMPL *session); -extern void __wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, int is_recno); +extern void __wt_root_ref_init(WT_REF *root_ref, WT_PAGE *root, bool is_recno); extern int __wt_btree_tree_open( WT_SESSION_IMPL *session, const uint8_t *addr, size_t addr_size); extern int __wt_btree_new_leaf_page(WT_SESSION_IMPL *session, WT_PAGE **pagep); -extern void __wt_btree_evictable(WT_SESSION_IMPL *session, int on); +extern void __wt_btree_evictable(WT_SESSION_IMPL *session, bool on); extern int __wt_btree_huffman_open(WT_SESSION_IMPL *session); extern void __wt_btree_huffman_close(WT_SESSION_IMPL *session); extern int __wt_bt_read(WT_SESSION_IMPL *session, WT_ITEM *buf, const uint8_t *addr, size_t addr_size); @@ -140,7 +140,7 @@ extern const char *__wt_addr_string(WT_SESSION_IMPL *session, const uint8_t *add extern int __wt_ovfl_read(WT_SESSION_IMPL *session, WT_PAGE *page, WT_CELL_UNPACK *unpack, WT_ITEM *store); extern int __wt_ovfl_cache(WT_SESSION_IMPL *session, WT_PAGE *page, void *cookie, WT_CELL_UNPACK *vpack); extern int __wt_ovfl_discard(WT_SESSION_IMPL *session, WT_CELL *cell); -extern int __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, uint64_t recno, uint32_t alloc_entries, int alloc_refs, WT_PAGE **pagep); +extern int __wt_page_alloc(WT_SESSION_IMPL *session, uint8_t type, uint64_t recno, uint32_t alloc_entries, bool alloc_refs, WT_PAGE **pagep); extern int __wt_page_inmem(WT_SESSION_IMPL *session, WT_REF *ref, const void *image, size_t memsize, uint32_t flags, WT_PAGE **pagep); extern int __wt_las_remove_block(WT_SESSION_IMPL *session, WT_CURSOR *cursor, uint32_t btree_id, const uint8_t *addr, size_t addr_size); extern int @@ -161,25 +161,25 @@ 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[]); extern int __wt_verify(WT_SESSION_IMPL *session, const char *cfg[]); -extern int __wt_verify_dsk_image(WT_SESSION_IMPL *session, const char *tag, const WT_PAGE_HEADER *dsk, size_t size, int empty_page_ok); +extern int __wt_verify_dsk_image(WT_SESSION_IMPL *session, const char *tag, const WT_PAGE_HEADER *dsk, size_t size, bool empty_page_ok); extern int __wt_verify_dsk(WT_SESSION_IMPL *session, const char *tag, WT_ITEM *buf); extern int __wt_tree_walk(WT_SESSION_IMPL *session, WT_REF **refp, uint64_t *walkcntp, uint32_t flags); -extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove); +extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove); extern int __wt_col_search(WT_SESSION_IMPL *session, uint64_t recno, WT_REF *leaf, WT_CURSOR_BTREE *cbt); extern int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page); extern int __wt_row_leaf_key_copy( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, WT_ITEM *key); -extern int __wt_row_leaf_key_work(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, int instantiate); +extern int __wt_row_leaf_key_work(WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *keyb, bool instantiate); extern int __wt_row_ikey_alloc(WT_SESSION_IMPL *session, uint32_t cell_offset, const void *key, size_t size, WT_IKEY **ikeyp); extern int __wt_row_ikey_incr(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t cell_offset, const void *key, size_t size, WT_REF *ref); extern int __wt_row_ikey(WT_SESSION_IMPL *session, uint32_t cell_offset, const void *key, size_t size, WT_REF *ref); extern int __wt_page_modify_alloc(WT_SESSION_IMPL *session, WT_PAGE *page); -extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, int is_remove); +extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *key, WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove); extern int __wt_row_insert_alloc(WT_SESSION_IMPL *session, WT_ITEM *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep); extern int __wt_update_alloc( WT_SESSION_IMPL *session, WT_ITEM *value, WT_UPDATE **updp, size_t *sizep); extern WT_UPDATE *__wt_update_obsolete_check( WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd); extern void __wt_update_obsolete_free( WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd); extern int __wt_search_insert( WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_ITEM *srch_key); -extern int __wt_row_search(WT_SESSION_IMPL *session, WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, int insert); +extern int __wt_row_search(WT_SESSION_IMPL *session, WT_ITEM *srch_key, WT_REF *leaf, WT_CURSOR_BTREE *cbt, bool insert); extern int __wt_row_random(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt); extern void __wt_las_stats_update(WT_SESSION_IMPL *session); extern int __wt_las_create(WT_SESSION_IMPL *session); @@ -318,9 +318,9 @@ extern void __wt_evict_list_clear_page(WT_SESSION_IMPL *session, WT_REF *ref); extern int __wt_evict_server_wake(WT_SESSION_IMPL *session); extern int __wt_evict_create(WT_SESSION_IMPL *session); extern int __wt_evict_destroy(WT_SESSION_IMPL *session); -extern int __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp); +extern int __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, bool *evict_resetp); extern void __wt_evict_file_exclusive_off(WT_SESSION_IMPL *session); -extern int __wt_cache_eviction_worker(WT_SESSION_IMPL *session, int busy, u_int pct_full); +extern int __wt_cache_eviction_worker(WT_SESSION_IMPL *session, bool busy, u_int pct_full); extern int __wt_cache_dump(WT_SESSION_IMPL *session, const char *ofile); extern int __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, bool closing); extern int __wt_evict_page_clean_update( WT_SESSION_IMPL *session, WT_REF *ref, bool closing); @@ -525,7 +525,7 @@ extern void __wt_yield(void); extern int __wt_ext_struct_pack(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, void *buffer, size_t size, const char *fmt, ...); extern int __wt_ext_struct_size(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, size_t *sizep, const char *fmt, ...); extern int __wt_ext_struct_unpack(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const void *buffer, size_t size, const char *fmt, ...); -extern int __wt_struct_check(WT_SESSION_IMPL *session, const char *fmt, size_t len, int *fixedp, uint32_t *fixed_lenp); +extern int __wt_struct_check(WT_SESSION_IMPL *session, const char *fmt, size_t len, bool *fixedp, uint32_t *fixed_lenp); extern int __wt_struct_confchk(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *v); extern int __wt_struct_size(WT_SESSION_IMPL *session, size_t *sizep, const char *fmt, ...); extern int __wt_struct_pack(WT_SESSION_IMPL *session, void *buffer, size_t size, const char *fmt, ...); @@ -633,7 +633,7 @@ extern void __wt_attach(WT_SESSION_IMPL *session); extern uint64_t __wt_hash_city64(const void *s, size_t len); extern uint64_t __wt_hash_fnv64(const void *string, size_t len); extern int -__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp +__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp #ifdef HAVE_DIAGNOSTIC , const char *file, int line #endif diff --git a/src/include/txn.i b/src/include/txn.i index 2b42990f5e5..54c30adae76 100644 --- a/src/include/txn.i +++ b/src/include/txn.i @@ -263,7 +263,7 @@ __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[]) * We're about to allocate a snapshot: if we need to block for * eviction, it's better to do it beforehand. */ - WT_RET(__wt_cache_eviction_check(session, 0, NULL)); + WT_RET(__wt_cache_eviction_check(session, false, NULL)); __wt_txn_get_snapshot(session); } @@ -327,7 +327,7 @@ __wt_txn_idle_cache_check(WT_SESSION_IMPL *session) */ if (F_ISSET(txn, WT_TXN_RUNNING) && !F_ISSET(txn, WT_TXN_HAS_ID) && txn_state->snap_min == WT_TXN_NONE) - WT_RET(__wt_cache_eviction_check(session, 0, NULL)); + WT_RET(__wt_cache_eviction_check(session, false, NULL)); return (0); } diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index c65d003b976..721eaba948c 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -648,9 +648,9 @@ retry: if (F_ISSET(clsm, WT_CLSM_MERGE)) { */ btree = ((WT_CURSOR_BTREE *)(primary))->btree; if (btree->bulk_load_ok) { - btree->bulk_load_ok = 0; + btree->bulk_load_ok = false; WT_WITH_BTREE(session, btree, - __wt_btree_evictable(session, 0)); + __wt_btree_evictable(session, false)); } } diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index 8eba0127b8b..d10b6becd2b 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -357,7 +357,7 @@ __wt_lsm_checkpoint_chunk(WT_SESSION_IMPL *session, * forced eviction. */ WT_RET(__wt_session_get_btree(session, chunk->uri, NULL, NULL, 0)); - __wt_btree_evictable(session, 1); + __wt_btree_evictable(session, true); WT_RET(__wt_session_release_btree(session)); /* Make sure we aren't pinning a transaction ID. */ diff --git a/src/packing/pack_impl.c b/src/packing/pack_impl.c index c92325a4c23..3a4428eae15 100644 --- a/src/packing/pack_impl.c +++ b/src/packing/pack_impl.c @@ -15,7 +15,7 @@ */ int __wt_struct_check(WT_SESSION_IMPL *session, - const char *fmt, size_t len, int *fixedp, uint32_t *fixed_lenp) + const char *fmt, size_t len, bool *fixedp, uint32_t *fixed_lenp) { WT_DECL_PACK_VALUE(pv); WT_DECL_RET; diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index da68627bed4..caf49810e3c 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -644,11 +644,11 @@ __rec_root_write(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t flags) switch (page->type) { case WT_PAGE_COL_INT: WT_RET(__wt_page_alloc(session, - WT_PAGE_COL_INT, 1, mod->mod_multi_entries, 0, &next)); + WT_PAGE_COL_INT, 1, mod->mod_multi_entries, false, &next)); break; case WT_PAGE_ROW_INT: WT_RET(__wt_page_alloc(session, - WT_PAGE_ROW_INT, 0, mod->mod_multi_entries, 0, &next)); + WT_PAGE_ROW_INT, 0, mod->mod_multi_entries, false, &next)); break; WT_ILLEGAL_VALUE(session); } @@ -2184,8 +2184,8 @@ __rec_split_row_promote( for (i = r->supd_next; i > 0; --i) { supd = &r->supd[i - 1]; if (supd->ins == NULL) - WT_ERR(__wt_row_leaf_key( - session, r->page, supd->rip, update, 0)); + WT_ERR(__wt_row_leaf_key(session, + r->page, supd->rip, update, false)); else { update->data = WT_INSERT_KEY(supd->ins); update->size = WT_INSERT_KEY_SIZE(supd->ins); @@ -2879,8 +2879,8 @@ __rec_raw_decompress( WT_ERR(__wt_illegal_value(session, btree->dhandle->name)); WT_ERR(__wt_strndup(session, tmp->data, dsk->mem_size, retp)); - WT_ASSERT(session, __wt_verify_dsk_image( - session, "[raw evict split]", tmp->data, dsk->mem_size, 0) == 0); + WT_ASSERT(session, __wt_verify_dsk_image(session, + "[raw evict split]", tmp->data, dsk->mem_size, false) == 0); err: __wt_scr_free(session, &tmp); return (ret); @@ -3170,7 +3170,7 @@ __rec_split_write(WT_SESSION_IMPL *session, case WT_PAGE_ROW_LEAF: if (supd->ins == NULL) WT_ERR(__wt_row_leaf_key( - session, page, supd->rip, key, 0)); + session, page, supd->rip, key, false)); else { key->data = WT_INSERT_KEY(supd->ins); key->size = WT_INSERT_KEY_SIZE(supd->ins); @@ -3231,7 +3231,7 @@ supd_check_complete: WT_ERR(__wt_strndup( session, buf->data, buf->size, &bnd->dsk)); WT_ASSERT(session, __wt_verify_dsk_image(session, - "[evict split]", buf->data, buf->size, 1) == 0); + "[evict split]", buf->data, buf->size, true) == 0); } goto done; } @@ -3369,7 +3369,7 @@ __rec_update_las(WT_SESSION_IMPL *session, case WT_PAGE_ROW_LEAF: if (list->ins == NULL) WT_ERR(__wt_row_leaf_key( - session, page, list->rip, key, 0)); + session, page, list->rip, key, false)); else { key->data = WT_INSERT_KEY(list->ins); key->size = WT_INSERT_KEY_SIZE(list->ins); @@ -4978,7 +4978,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session, if (ikey == NULL) WT_ERR(__wt_row_leaf_key( session, - page, rip, tmpkey, 1)); + page, rip, tmpkey, true)); WT_ERR(__wt_ovfl_discard_add( session, page, kpack->cell)); diff --git a/src/support/hazard.c b/src/support/hazard.c index 0f45c1dfd99..7c118c8f67a 100644 --- a/src/support/hazard.c +++ b/src/support/hazard.c @@ -17,7 +17,7 @@ static void __hazard_dump(WT_SESSION_IMPL *); * Set a hazard pointer. */ int -__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp +__wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, bool *busyp #ifdef HAVE_DIAGNOSTIC , const char *file, int line #endif @@ -30,7 +30,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp btree = S2BT(session); conn = S2C(session); - *busyp = 0; + *busyp = false; /* If a file can never be evicted, hazard pointers aren't required. */ if (F_ISSET(btree, WT_BTREE_IN_MEMORY)) @@ -117,7 +117,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp * prevent some random page from being evicted. */ hp->page = NULL; - *busyp = 1; + *busyp = true; return (0); } |