diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-09-05 21:59:46 -0400 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-09-06 11:59:46 +1000 |
commit | 3aab0803b5401c8aed08813cb58d3a6f341fbb00 (patch) | |
tree | 76f8d9e9c655b5d66517bf0d08c775edf237e293 | |
parent | 375066e5cf6c16cb338452fa3a7dd032cd5aad8d (diff) | |
download | mongo-3aab0803b5401c8aed08813cb58d3a6f341fbb00.tar.gz |
WT-2888 Switch functions to return void where possible (#3019)
Some functions return an error code even though they don't need to. That adds complexity to our code. Switch to returning a void.
51 files changed, 317 insertions, 218 deletions
diff --git a/bench/wtperf/config.c b/bench/wtperf/config.c index 3366fda15f7..48127afc10e 100644 --- a/bench/wtperf/config.c +++ b/bench/wtperf/config.c @@ -97,7 +97,7 @@ config_unescape(char *orig) * config_copy -- * CONFIG structure initialization, based on a source configuration. */ -int +void config_copy(CONFIG *dest, const CONFIG *src) { CONFIG_QUEUE_ENTRY *conf_line, *tmp_line; @@ -156,7 +156,6 @@ config_copy(CONFIG *dest, const CONFIG *src) tmp_line->string = dstrdup(conf_line->string); TAILQ_INSERT_TAIL(&dest->config_head, tmp_line, c); } - return (0); } /* diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index 8fab2f82615..bf6b156bb69 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -2006,8 +2006,7 @@ start_all_runs(CONFIG *cfg) for (i = 0; i < cfg->database_count; i++) { next_cfg = dcalloc(1, sizeof(CONFIG)); configs[i] = next_cfg; - if ((ret = config_copy(next_cfg, cfg)) != 0) - goto err; + config_copy(next_cfg, cfg); /* Setup a unique home directory for each database. */ new_home = dmalloc(home_len + 5); @@ -2238,8 +2237,7 @@ main(int argc, char *argv[]) /* Setup the default configuration values. */ cfg = &_cfg; memset(cfg, 0, sizeof(*cfg)); - if (config_copy(cfg, &default_cfg)) - goto err; + config_copy(cfg, &default_cfg); cfg->home = dstrdup(DEFAULT_HOME); cfg->monitor_dir = dstrdup(DEFAULT_MONITOR_DIR); diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h index 85a821b45eb..1bb94db2634 100644 --- a/bench/wtperf/wtperf.h +++ b/bench/wtperf/wtperf.h @@ -263,7 +263,7 @@ struct __config_thread { /* Per-thread structure */ void cleanup_truncate_config(CONFIG *); int config_compress(CONFIG *); void config_free(CONFIG *); -int config_copy(CONFIG *, const CONFIG *); +void config_copy(CONFIG *, const CONFIG *); int config_opt_file(CONFIG *, const char *); int config_opt_line(CONFIG *, const char *); int config_opt_str(CONFIG *, const char *, const char *); diff --git a/dist/s_void b/dist/s_void new file mode 100644 index 00000000000..68c7ea06031 --- /dev/null +++ b/dist/s_void @@ -0,0 +1,135 @@ +#! /bin/sh + +t=__wt.$$ +trap 'rm -f $t; exit 0' 0 1 2 3 13 15 + +cd .. + +# Turn a C file into a line per function that returns an int. +file_parse() +{ + sed -n \ + -e '/^int$/b loop' \ + -e '/^static int$/b loop' \ + -e 'd' \ + -e ': loop' \ + -e 'H' \ + -e 'n' \ + -e '/^}$/!b loop' \ + -e 'H' \ + -e 'x' \ + -e 's/\n/ /g' \ + -e 'p' \ + -e 's/.*//' \ + -e 'x' \ + -e 'd' $1 +} + +# Strip out a list of functions that will be flagged, but are OK. +func_ok() +{ + sed \ + -e '/int __bm_stat$/d' \ + -e '/int __checkpoint_presync$/d' \ + -e '/int __compact_uri_analyze$/d' \ + -e '/int __curlog_reset$/d' \ + -e '/int __handle_close_default$/d' \ + -e '/int __handle_progress_default$/d' \ + -e '/int __im_file_close$/d' \ + -e '/int __im_file_lock$/d' \ + -e '/int __im_file_size$/d' \ + -e '/int __im_file_sync$/d' \ + -e '/int __im_fs_directory_list_free$/d' \ + -e '/int __im_fs_exist$/d' \ + -e '/int __posix_file_close$/d' \ + -e '/int __posix_terminate$/d' \ + -e '/int __rec_destroy_session$/d' \ + -e '/int __session_transaction_pinned_range$/d' \ + -e '/int __win_terminate$/d' \ + -e '/int __wt_block_compact_end$/d' \ + -e '/int __wt_block_compact_start$/d' \ + -e '/int __wt_block_manager_size$/d' \ + -e '/int __wt_block_write_size$/d' \ + -e '/int __wt_curjoin_joined$/d' \ + -e '/int __wt_cursor_close$/d' \ + -e '/int __wt_cursor_noop$/d' \ + -e '/int __wt_epoch$/d' \ + -e '/int __wt_errno$/d' \ + -e '/int __wt_get_vm_pagesize$/d' \ + -e '/int __wt_lsm_manager_pop_entry$/d' \ + -e '/int __wt_once$/d' \ + -e '/int __wt_posix_directory_list_free$/d' \ + -e '/int __wt_stat_connection_desc$/d' \ + -e '/int __wt_stat_dsrc_desc$/d' \ + -e '/int __wt_stat_join_desc$/d' \ + -e '/int __wt_win_directory_list_free$/d' \ + -e '/int bdb_compare_reverse$/d' \ + -e '/int csv_terminate$/d' \ + -e '/int demo_file_close$/d' \ + -e '/int demo_file_lock$/d' \ + -e '/int demo_file_size$/d' \ + -e '/int demo_file_sync$/d' \ + -e '/int demo_fs_directory_list_free$/d' \ + -e '/int demo_fs_exist$/d' \ + -e '/int handle_message$/d' \ + -e '/int handle_progress$/d' \ + -e '/int helium_cursor_reset$/d' \ + -e '/int helium_session_verify$/d' \ + -e '/int log_print_err$/d' \ + -e '/int lz4_error$/d' \ + -e '/int lz4_pre_size$/d' \ + -e '/int lz4_terminate$/d' \ + -e '/int main$/d' \ + -e '/int nop_decompress$/d' \ + -e '/int nop_decrypt$/d' \ + -e '/int nop_pre_size$/d' \ + -e '/int nop_sizing$/d' \ + -e '/int nop_terminate$/d' \ + -e '/int nop_terminate$/d' \ + -e '/int os_errno$/d' \ + -e '/int revint_terminate$/d' \ + -e '/int rotn_error$/d' \ + -e '/int rotn_sizing$/d' \ + -e '/int rotn_terminate$/d' \ + -e '/int uri2name$/d' \ + -e '/int usage$/d' \ + -e '/int util_err$/d' \ + -e '/int wiredtiger_extension_init$/d' \ + -e '/int wiredtiger_extension_terminate$/d' \ + -e '/int wiredtiger_pack_close$/d' \ + -e '/int wt_snappy_pre_size$/d' \ + -e '/int wt_snappy_terminate$/d' \ + -e '/int zlib_error$/d' \ + -e '/int zlib_terminate$/d' +} + +# Complain about functions which return an "int" but which don't return except +# at the end of the function. This script is a kluge and isn't run by default. +for f in `find bench ext src test -name '*.[ci]'`; do + if expr "$f" : '.*/windows_shim.c' > /dev/null; then + continue + fi + + # Turn each function into a single line, then discard the function's + # final "return" call, then discard any function that still has some + # form of return assignment or call. + file_parse $f | + sed -e 's/return ([^)]*); }$//' \ + -e '/[A-Z]*_API_CALL(/d' \ + -e '/WT_CURSOR_NEEDKEY(/d' \ + -e '/WT_CURSOR_NEEDVALUE(/d' \ + -e '/WT_ERR[A-Z_]*(/d' \ + -e '/WT_ILLEGAL_VALUE[A-Z_]*(/d' \ + -e '/WT_PANIC[A-Z_]*(/d' \ + -e '/WT_RET[A-Z_]*(/d' \ + -e '/WT_TRET(/d' \ + -e '/[^a-z_]ret = /d' \ + -e '/[^a-z_]return (/d' \ + -e 's/^\([^(]*\).*/\1/' \ + -e 's/^ *//' | + func_ok > $t + test -s $t && { + echo "========== $f" + cat $t + } +done diff --git a/ext/collators/revint/revint_collator.c b/ext/collators/revint/revint_collator.c index 30b5dc67556..b8ebbdc8585 100644 --- a/ext/collators/revint/revint_collator.c +++ b/ext/collators/revint/revint_collator.c @@ -54,8 +54,8 @@ revint_compare(WT_COLLATOR *collator, const REVINT_COLLATOR *revint_collator; WT_EXTENSION_API *wtapi; WT_PACK_STREAM *pstream; - int ret; int64_t i1, i2, p1, p2; + int ret; i1 = i2 = p1 = p2 = 0; revint_collator = (const REVINT_COLLATOR *)collator; @@ -82,23 +82,23 @@ revint_compare(WT_COLLATOR *collator, if ((ret = wtapi->unpack_start( wtapi, session, "ii", k1->data, k1->size, &pstream)) != 0 || (ret = wtapi->unpack_int(wtapi, pstream, &i1)) != 0) - goto err; + return (ret); if ((ret = wtapi->unpack_int(wtapi, pstream, &p1)) != 0) /* A missing primary key is OK and sorts first. */ p1 = INT64_MIN; if ((ret = wtapi->pack_close(wtapi, pstream, NULL)) != 0) - goto err; + return (ret); /* Unpack the second pair of numbers. */ if ((ret = wtapi->unpack_start( wtapi, session, "ii", k2->data, k2->size, &pstream)) != 0 || (ret = wtapi->unpack_int(wtapi, pstream, &i2)) != 0) - goto err; + return (ret); if ((ret = wtapi->unpack_int(wtapi, pstream, &p2)) != 0) /* A missing primary key is OK and sorts first. */ p2 = INT64_MIN; if ((ret = wtapi->pack_close(wtapi, pstream, NULL)) != 0) - goto err; + return (ret); /* sorting is reversed */ if (i1 < i2) @@ -113,7 +113,7 @@ revint_compare(WT_COLLATOR *collator, else *cmp = 0; /* index key and primary key are same */ -err: return (ret); + return (0); } /* diff --git a/src/async/async_op.c b/src/async/async_op.c index 970c33c3360..2bdc9e4ec8e 100644 --- a/src/async/async_op.c +++ b/src/async/async_op.c @@ -205,7 +205,7 @@ __async_get_type(WT_ASYNC_OP *asyncop) * __async_op_init -- * Initialize all the op handle fields. */ -static int +static void __async_op_init(WT_CONNECTION_IMPL *conn, WT_ASYNC_OP_IMPL *op, uint32_t id) { WT_ASYNC_OP *asyncop; @@ -243,7 +243,6 @@ __async_op_init(WT_CONNECTION_IMPL *conn, WT_ASYNC_OP_IMPL *op, uint32_t id) op->internal_id = id; op->state = WT_ASYNCOP_FREE; - return (0); } /* @@ -330,7 +329,7 @@ __wt_async_op_init(WT_SESSION_IMPL *session) /* * Initialize the flush op structure. */ - WT_RET(__async_op_init(conn, &async->flush_op, OPS_INVALID_INDEX)); + __async_op_init(conn, &async->flush_op, OPS_INVALID_INDEX); /* * Allocate and initialize the work queue. This is sized so that @@ -346,7 +345,7 @@ __wt_async_op_init(WT_SESSION_IMPL *session) WT_ERR(__wt_calloc_def(session, conn->async_size, &async->async_ops)); for (i = 0; i < conn->async_size; i++) { op = &async->async_ops[i]; - WT_ERR(__async_op_init(conn, op, i)); + __async_op_init(conn, op, i); } return (0); diff --git a/src/bloom/bloom.c b/src/bloom/bloom.c index 76b1b5f68ad..3afada05dda 100644 --- a/src/bloom/bloom.c +++ b/src/bloom/bloom.c @@ -174,7 +174,7 @@ err: WT_TRET(__wt_bloom_close(bloom)); * __wt_bloom_insert -- * Adds the given key to the Bloom filter. */ -int +void __wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key) { uint64_t h1, h2; @@ -182,10 +182,8 @@ __wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key) h1 = __wt_hash_fnv64(key->data, key->size); h2 = __wt_hash_city64(key->data, key->size); - for (i = 0; i < bloom->k; i++, h1 += h2) { + for (i = 0; i < bloom->k; i++, h1 += h2) __bit_set(bloom->bitstring, h1 % bloom->m); - } - return (0); } /* @@ -238,15 +236,13 @@ err: WT_TRET(c->close(c)); * __wt_bloom_hash -- * Calculate the hash values for a given key. */ -int +void __wt_bloom_hash(WT_BLOOM *bloom, WT_ITEM *key, WT_BLOOM_HASH *bhash) { WT_UNUSED(bloom); bhash->h1 = __wt_hash_fnv64(key->data, key->size); bhash->h2 = __wt_hash_city64(key->data, key->size); - - return (0); } /* @@ -309,7 +305,7 @@ __wt_bloom_get(WT_BLOOM *bloom, WT_ITEM *key) { WT_BLOOM_HASH bhash; - WT_RET(__wt_bloom_hash(bloom, key, &bhash)); + __wt_bloom_hash(bloom, key, &bhash); return (__wt_bloom_hash_get(bloom, &bhash)); } diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index 9a57759570a..982226f589f 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -1212,7 +1212,7 @@ __wt_btcur_range_truncate(WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop) } err: if (FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_ENABLED)) - WT_TRET(__wt_txn_truncate_end(session)); + __wt_txn_truncate_end(session); return (ret); } diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index c1560150435..515d0cd6135 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -140,13 +140,14 @@ __dmsg_event(WT_DBG *ds, const char *fmt, ...) static int __dmsg_file(WT_DBG *ds, const char *fmt, ...) { + WT_DECL_RET; va_list ap; va_start(ap, fmt); - (void)vfprintf(ds->fp, fmt, ap); + ret = vfprintf(ds->fp, fmt, ap) < 0 ? EIO : 0; va_end(ap); - return (0); + return (ret); } /* diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index 89e5f428628..7bac7079fe8 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -296,7 +296,7 @@ __inmem_col_int(WT_SESSION_IMPL *session, WT_PAGE *page) * __inmem_col_var_repeats -- * Count the number of repeat entries on the page. */ -static int +static void __inmem_col_var_repeats(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t *np) { WT_BTREE *btree; @@ -316,7 +316,6 @@ __inmem_col_var_repeats(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t *np) if (__wt_cell_rle(unpack) > 1) ++*np; } - return (0); } /* @@ -367,8 +366,7 @@ __inmem_col_var( rle = __wt_cell_rle(unpack); if (rle > 1) { if (repeats == NULL) { - WT_RET( - __inmem_col_var_repeats(session, page, &n)); + __inmem_col_var_repeats(session, page, &n); WT_RET(__wt_realloc_def(session, &bytes_allocated, n + 1, &repeats)); diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index b096fd432e9..079887118f9 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -147,7 +147,7 @@ __las_page_instantiate(WT_SESSION_IMPL *session, WT_ERR(__wt_scr_alloc(session, 0, &las_value)); /* Open a lookaside table cursor. */ - WT_ERR(__wt_las_cursor(session, &cursor, &session_flags)); + __wt_las_cursor(session, &cursor, &session_flags); /* * The lookaside records are in key and update order, that is, there diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index fec78ee272d..f269c2d7f43 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -119,7 +119,7 @@ static int __slvg_col_build_leaf(WT_SESSION_IMPL *, WT_TRACK *, WT_REF *); static int __slvg_col_ovfl(WT_SESSION_IMPL *, WT_TRACK *, WT_PAGE *, uint64_t, uint64_t, uint64_t); static int __slvg_col_range(WT_SESSION_IMPL *, WT_STUFF *); -static int __slvg_col_range_missing(WT_SESSION_IMPL *, WT_STUFF *); +static void __slvg_col_range_missing(WT_SESSION_IMPL *, WT_STUFF *); static int __slvg_col_range_overlap( WT_SESSION_IMPL *, uint32_t, uint32_t, WT_STUFF *); static void __slvg_col_trk_update_start(uint32_t, WT_STUFF *); @@ -281,7 +281,7 @@ __wt_bt_salvage(WT_SESSION_IMPL *session, WT_CKPT *ckptbase, const char *cfg[]) switch (ss->page_type) { case WT_PAGE_COL_FIX: case WT_PAGE_COL_VAR: - WT_ERR(__slvg_col_range_missing(session, ss)); + __slvg_col_range_missing(session, ss); break; case WT_PAGE_ROW_LEAF: break; @@ -1107,7 +1107,7 @@ __slvg_col_trk_update_start(uint32_t slot, WT_STUFF *ss) * __slvg_col_range_missing -- * Detect missing ranges from column-store files. */ -static int +static void __slvg_col_range_missing(WT_SESSION_IMPL *session, WT_STUFF *ss) { WT_TRACK *trk; @@ -1134,7 +1134,6 @@ __slvg_col_range_missing(WT_SESSION_IMPL *session, WT_STUFF *ss) } r = trk->col_stop; } - return (0); } /* diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 76817cef7cd..340f9bb6f0e 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -89,7 +89,7 @@ __verify_config_offsets( *quitp = false; WT_RET(__wt_config_gets(session, cfg, "dump_offsets", &cval)); - WT_RET(__wt_config_subinit(session, &list, &cval)); + __wt_config_subinit(session, &list, &cval); while ((ret = __wt_config_next(&list, &k, &v)) == 0) { /* * Quit after dumping the requested blocks. (That's hopefully diff --git a/src/cache/cache_las.c b/src/cache/cache_las.c index 27c2900fa98..4c338bc6ad9 100644 --- a/src/cache/cache_las.c +++ b/src/cache/cache_las.c @@ -200,7 +200,7 @@ __wt_las_cursor_open(WT_SESSION_IMPL *session, WT_CURSOR **cursorp) * __wt_las_cursor -- * Return a lookaside cursor. */ -int +void __wt_las_cursor( WT_SESSION_IMPL *session, WT_CURSOR **cursorp, uint32_t *session_flags) { @@ -235,8 +235,6 @@ __wt_las_cursor( /* Turn caching and eviction off. */ F_SET(session, WT_SESSION_NO_CACHE | WT_SESSION_NO_EVICTION); - - return (0); } /* @@ -304,7 +302,7 @@ __wt_las_sweep(WT_SESSION_IMPL *session) WT_ERR(__wt_scr_alloc(session, 0, &las_addr)); WT_ERR(__wt_scr_alloc(session, 0, &las_key)); - WT_ERR(__wt_las_cursor(session, &cursor, &session_flags)); + __wt_las_cursor(session, &cursor, &session_flags); /* * If we're not starting a new sweep, position the cursor using the key diff --git a/src/config/config.c b/src/config/config.c index 96ef7a4e62a..3416153d160 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -26,7 +26,7 @@ __config_err(WT_CONFIG *conf, const char *msg, int err) * Initialize a config handle, used to iterate through a config string of * specified length. */ -int +void __wt_config_initn( WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str, size_t len) { @@ -36,8 +36,6 @@ __wt_config_initn( conf->depth = 0; conf->top = -1; conf->go = NULL; - - return (0); } /* @@ -45,14 +43,14 @@ __wt_config_initn( * Initialize a config handle, used to iterate through a NUL-terminated * config string. */ -int +void __wt_config_init(WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str) { size_t len; len = (str == NULL) ? 0 : strlen(str); - return (__wt_config_initn(session, conf, str, len)); + __wt_config_initn(session, conf, str, len); } /* @@ -61,11 +59,11 @@ __wt_config_init(WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str) * extracted from another config string (used for parsing nested * structures). */ -int +void __wt_config_subinit( WT_SESSION_IMPL *session, WT_CONFIG *conf, WT_CONFIG_ITEM *item) { - return (__wt_config_initn(session, conf, item->str, item->len)); + __wt_config_initn(session, conf, item->str, item->len); } #define PUSH(i, t) do { \ @@ -601,8 +599,8 @@ __config_getraw( strncmp(key->str, k.str, k.len) == 0) { subk.str = key->str + k.len + 1; subk.len = (key->len - k.len) - 1; - WT_RET(__wt_config_initn( - cparser->session, &sparser, v.str, v.len)); + __wt_config_initn( + cparser->session, &sparser, v.str, v.len); if ((ret = __config_getraw( &sparser, &subk, value, false)) == 0) found = true; @@ -641,7 +639,7 @@ __wt_config_get(WT_SESSION_IMPL *session, do { --cfg; - WT_RET(__wt_config_init(session, &cparser, *cfg)); + __wt_config_init(session, &cparser, *cfg); if ((ret = __config_getraw(&cparser, key, value, true)) == 0) return (0); WT_RET_NOTFOUND_OK(ret); @@ -690,7 +688,7 @@ __wt_config_getone(WT_SESSION_IMPL *session, { WT_CONFIG cparser; - WT_RET(__wt_config_init(session, &cparser, config)); + __wt_config_init(session, &cparser, config); return (__config_getraw(&cparser, key, value, true)); } @@ -706,7 +704,7 @@ __wt_config_getones(WT_SESSION_IMPL *session, WT_CONFIG_ITEM key_item = { key, strlen(key), 0, WT_CONFIG_ITEM_STRING }; - WT_RET(__wt_config_init(session, &cparser, config)); + __wt_config_init(session, &cparser, config); return (__config_getraw(&cparser, &key_item, value, true)); } @@ -771,7 +769,7 @@ __wt_config_subgetraw(WT_SESSION_IMPL *session, { WT_CONFIG cparser; - WT_RET(__wt_config_initn(session, &cparser, cfg->str, cfg->len)); + __wt_config_initn(session, &cparser, cfg->str, cfg->len); return (__config_getraw(&cparser, key, value, true)); } diff --git a/src/config/config_api.c b/src/config/config_api.c index b5228c4329c..8655057e94d 100644 --- a/src/config/config_api.c +++ b/src/config/config_api.c @@ -79,7 +79,6 @@ wiredtiger_config_parser_open(WT_SESSION *wt_session, WT_CONFIG_ITEM config_item = { config, len, 0, WT_CONFIG_ITEM_STRING }; WT_CONFIG_PARSER_IMPL *config_parser; - WT_DECL_RET; WT_SESSION_IMPL *session; *config_parserp = NULL; @@ -94,14 +93,10 @@ wiredtiger_config_parser_open(WT_SESSION *wt_session, * structure for iterations through the configuration string. */ memcpy(&config_parser->config_item, &config_item, sizeof(config_item)); - WT_ERR(__wt_config_initn(session, &config_parser->config, config, len)); - - if (ret == 0) - *config_parserp = (WT_CONFIG_PARSER *)config_parser; - else -err: __wt_free(session, config_parser); + __wt_config_initn(session, &config_parser->config, config, len); - return (ret); + *config_parserp = (WT_CONFIG_PARSER *)config_parser; + return (0); } /* diff --git a/src/config/config_check.c b/src/config/config_check.c index c29013483f6..d0aa09a96c1 100644 --- a/src/config/config_check.c +++ b/src/config/config_check.c @@ -91,9 +91,9 @@ config_check(WT_SESSION_IMPL *session, * that are not nul-terminated. */ if (config_len == 0) - WT_RET(__wt_config_init(session, &parser, config)); + __wt_config_init(session, &parser, config); else - WT_RET(__wt_config_initn(session, &parser, config, config_len)); + __wt_config_initn(session, &parser, config, config_len); while ((ret = __wt_config_next(&parser, &k, &v)) == 0) { if (k.type != WT_CONFIG_ITEM_STRING && k.type != WT_CONFIG_ITEM_ID) @@ -143,7 +143,7 @@ config_check(WT_SESSION_IMPL *session, continue; /* Setup an iterator for the check string. */ - WT_RET(__wt_config_init(session, &cparser, checks[i].checks)); + __wt_config_init(session, &cparser, checks[i].checks); while ((ret = __wt_config_next(&cparser, &ck, &cv)) == 0) { if (WT_STRING_MATCH("min", ck.str, ck.len)) { if (v.val < cv.val) @@ -169,8 +169,8 @@ config_check(WT_SESSION_IMPL *session, * Handle the 'verbose' case of a list * containing restricted choices. */ - WT_RET(__wt_config_subinit(session, - &sparser, &v)); + __wt_config_subinit( + session, &sparser, &v); found = true; while (found && (ret = __wt_config_next(&sparser, diff --git a/src/config/config_collapse.c b/src/config/config_collapse.c index 591d22284f5..ea956ebfff9 100644 --- a/src/config/config_collapse.c +++ b/src/config/config_collapse.c @@ -42,7 +42,7 @@ __wt_config_collapse( WT_RET(__wt_scr_alloc(session, 0, &tmp)); - WT_ERR(__wt_config_init(session, &cparser, cfg[0])); + __wt_config_init(session, &cparser, cfg[0]); while ((ret = __wt_config_next(&cparser, &k, &v)) == 0) { if (k.type != WT_CONFIG_ITEM_STRING && k.type != WT_CONFIG_ITEM_ID) @@ -127,7 +127,7 @@ __config_merge_scan(WT_SESSION_IMPL *session, WT_ERR(__wt_scr_alloc(session, 0, &kb)); WT_ERR(__wt_scr_alloc(session, 0, &vb)); - WT_ERR(__wt_config_init(session, &cparser, value)); + __wt_config_init(session, &cparser, value); while ((ret = __wt_config_next(&cparser, &k, &v)) == 0) { if (k.type != WT_CONFIG_ITEM_STRING && k.type != WT_CONFIG_ITEM_ID) diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index ab7657c3a89..61683f3394e 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -919,7 +919,7 @@ __conn_load_extensions( WT_CONFIG_BASE(session, WT_CONNECTION_load_extension), NULL, NULL }; WT_ERR(__wt_config_gets(session, cfg, "extensions", &cval)); - WT_ERR(__wt_config_subinit(session, &subconfig, &cval)); + __wt_config_subinit(session, &subconfig, &cval); while ((ret = __wt_config_next(&subconfig, &skey, &sval)) == 0) { if (expath == NULL) WT_ERR(__wt_scr_alloc(session, 0, &expath)); @@ -1020,7 +1020,7 @@ err: /* } /* Release all named snapshots. */ - WT_TRET(__wt_txn_named_snapshot_destroy(session)); + __wt_txn_named_snapshot_destroy(session); /* Close open, external sessions. */ for (s = conn->sessions, i = 0; i < conn->session_cnt; ++s, ++i) @@ -1854,7 +1854,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[]) "readonly=," "use_environment_priv=," "verbose=,", &base_config)); - WT_ERR(__wt_config_init(session, &parser, base_config)); + __wt_config_init(session, &parser, base_config); while ((ret = __wt_config_next(&parser, &k, &v)) == 0) { /* Fix quoting for non-trivial settings. */ if (v.type == WT_CONFIG_ITEM_STRING) { @@ -2009,7 +2009,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, session->name = "wiredtiger_open"; /* Do standard I/O and error handling first. */ - WT_ERR(__wt_os_stdio(session)); + __wt_os_stdio(session); __wt_event_handler_set(session, event_handler); /* diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c index 15517f37b6a..ba6097fd2c1 100644 --- a/src/conn/conn_cache_pool.c +++ b/src/conn/conn_cache_pool.c @@ -34,10 +34,10 @@ #define WT_CACHE_POOL_APP_WAIT_MULTIPLIER 6 #define WT_CACHE_POOL_READ_MULTIPLIER 1 -static int __cache_pool_adjust( +static void __cache_pool_adjust( WT_SESSION_IMPL *, uint64_t, uint64_t, bool, bool *); -static int __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *); -static int __cache_pool_balance(WT_SESSION_IMPL *, bool); +static void __cache_pool_assess(WT_SESSION_IMPL *, uint64_t *); +static void __cache_pool_balance(WT_SESSION_IMPL *, bool); /* * __wt_cache_pool_config -- @@ -414,11 +414,10 @@ __wt_conn_cache_pool_destroy(WT_SESSION_IMPL *session) * Do a pass over the cache pool members and ensure the pool is being * effectively used. */ -static int +static void __cache_pool_balance(WT_SESSION_IMPL *session, bool forward) { WT_CACHE_POOL *cp; - WT_DECL_RET; bool adjusted; uint64_t bump_threshold, highest; @@ -429,10 +428,12 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward) __wt_spin_lock(NULL, &cp->cache_pool_lock); /* If the queue is empty there is nothing to do. */ - if (TAILQ_FIRST(&cp->cache_pool_qh) == NULL) - goto err; + if (TAILQ_FIRST(&cp->cache_pool_qh) == NULL) { + __wt_spin_unlock(NULL, &cp->cache_pool_lock); + return; + } - WT_ERR(__cache_pool_assess(session, &highest)); + __cache_pool_assess(session, &highest); bump_threshold = WT_CACHE_POOL_BUMP_THRESHOLD; /* @@ -442,8 +443,8 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward) */ while (F_ISSET(cp, WT_CACHE_POOL_ACTIVE) && F_ISSET(S2C(session)->cache, WT_CACHE_POOL_RUN)) { - WT_ERR(__cache_pool_adjust( - session, highest, bump_threshold, forward, &adjusted)); + __cache_pool_adjust( + session, highest, bump_threshold, forward, &adjusted); /* * Stop if the amount of cache being used is stable, and we * aren't over capacity. @@ -454,15 +455,14 @@ __cache_pool_balance(WT_SESSION_IMPL *session, bool forward) --bump_threshold; } -err: __wt_spin_unlock(NULL, &cp->cache_pool_lock); - return (ret); + __wt_spin_unlock(NULL, &cp->cache_pool_lock); } /* * __cache_pool_assess -- * Assess the usage of the cache pool. */ -static int +static void __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest) { WT_CACHE_POOL *cp; @@ -548,7 +548,6 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest) highest, entries); *phighest = highest; - return (0); } /* @@ -557,7 +556,7 @@ __cache_pool_assess(WT_SESSION_IMPL *session, uint64_t *phighest) * ignore cache load information, and reduce the allocation for every * connection allocated more than their reserved size. */ -static int +static void __cache_pool_adjust(WT_SESSION_IMPL *session, uint64_t highest, uint64_t bump_threshold, bool forward, bool *adjustedp) { @@ -709,7 +708,6 @@ __cache_pool_adjust(WT_SESSION_IMPL *session, */ } } - return (0); } /* @@ -756,7 +754,7 @@ __wt_cache_pool_server(void *arg) * reported in the balance function. */ if (F_ISSET(cache, WT_CACHE_POOL_MANAGER)) { - (void)__cache_pool_balance(session, forward); + __cache_pool_balance(session, forward); forward = !forward; } } diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c index 9eb4d4a7746..ec850c793cc 100644 --- a/src/conn/conn_dhandle.c +++ b/src/conn/conn_dhandle.c @@ -488,9 +488,9 @@ __wt_conn_dhandle_close_all( * open at this point. Close the handle, if necessary. */ if (F_ISSET(dhandle, WT_DHANDLE_OPEN)) { - if ((ret = __wt_meta_track_sub_on(session)) == 0) - ret = __wt_conn_btree_sync_and_close( - session, false, force); + __wt_meta_track_sub_on(session); + ret = __wt_conn_btree_sync_and_close( + session, false, force); /* * If the close succeeded, drop any locks it acquired. diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 0894d1c6058..530bbfcd2db 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -155,13 +155,13 @@ __statlog_config(WT_SESSION_IMPL *session, const char **cfg, bool *runp) WT_ERR(__wt_filename(session, tmp->data, &conn->stat_path)); WT_ERR(__wt_config_gets(session, cfg, "statistics_log.sources", &cval)); - WT_ERR(__wt_config_subinit(session, &objectconf, &cval)); + __wt_config_subinit(session, &objectconf, &cval); for (cnt = 0; (ret = __wt_config_next(&objectconf, &k, &v)) == 0; ++cnt) ; WT_ERR_NOTFOUND_OK(ret); if (cnt != 0) { WT_ERR(__wt_calloc_def(session, cnt + 1, &sources)); - WT_ERR(__wt_config_subinit(session, &objectconf, &cval)); + __wt_config_subinit(session, &objectconf, &cval); for (cnt = 0; (ret = __wt_config_next(&objectconf, &k, &v)) == 0; ++cnt) { /* diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index dda296f50f3..240c5726fb0 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -17,7 +17,7 @@ * Mark idle handles with a time of death, and note if we see dead * handles. */ -static int +static void __sweep_mark(WT_SESSION_IMPL *session, time_t now) { WT_CONNECTION_IMPL *conn; @@ -50,8 +50,6 @@ __sweep_mark(WT_SESSION_IMPL *session, time_t now) dhandle->timeofdeath = now; WT_STAT_FAST_CONN_INCR(session, dh_sweep_tod); } - - return (0); } /* @@ -303,7 +301,7 @@ __sweep_server(void *arg) * never become idle. */ if (conn->sweep_idle_time != 0) - WT_ERR(__sweep_mark(session, now)); + __sweep_mark(session, now); /* * Close handles if we have reached the configured limit. diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c index 598da3f0ac6..3a3ff7de92b 100644 --- a/src/cursor/cur_backup.c +++ b/src/cursor/cur_backup.c @@ -387,7 +387,7 @@ __backup_uri(WT_SESSION_IMPL *session, * otherwise it's not our problem. */ WT_RET(__wt_config_gets(session, cfg, "target", &cval)); - WT_RET(__wt_config_subinit(session, &targetconf, &cval)); + __wt_config_subinit(session, &targetconf, &cval); for (target_list = false; (ret = __wt_config_next(&targetconf, &k, &v)) == 0; target_list = true) { diff --git a/src/cursor/cur_index.c b/src/cursor/cur_index.c index 82a27d65ce6..ea742cac435 100644 --- a/src/cursor/cur_index.c +++ b/src/cursor/cur_index.c @@ -513,8 +513,8 @@ __wt_curindex_open(WT_SESSION_IMPL *session, WT_ERR(__curindex_open_colgroups(session, cindex, cfg)); if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON)) - WT_ERR(__wt_json_column_init(cursor, table->key_format, - &idx->colconf, &table->colconf)); + __wt_json_column_init( + cursor, table->key_format, &idx->colconf, &table->colconf); if (0) { err: WT_TRET(__curindex_close(cursor)); diff --git a/src/cursor/cur_join.c b/src/cursor/cur_join.c index 601bb593240..087411febda 100644 --- a/src/cursor/cur_join.c +++ b/src/cursor/cur_join.c @@ -873,7 +873,7 @@ insert: } else WT_ERR(c->get_key(c, &curvalue)); - WT_ERR(__wt_bloom_insert(bloom, &curvalue)); + __wt_bloom_insert(bloom, &curvalue); entry->stats.bloom_insert++; advance: if ((ret = c->next(c)) == WT_NOTFOUND) diff --git a/src/cursor/cur_json.c b/src/cursor/cur_json.c index f0fa0d8aec2..bb24e88cba5 100644 --- a/src/cursor/cur_json.c +++ b/src/cursor/cur_json.c @@ -186,7 +186,7 @@ __json_struct_size(WT_SESSION_IMPL *session, const void *buffer, result = 0; needcr = false; - WT_RET(__pack_name_init(session, names, iskey, &packname)); + __pack_name_init(session, names, iskey, &packname); WT_RET(__pack_init(session, &pack, fmt)); while ((ret = __pack_next(&pack, &pv)) == 0) { if (needcr) @@ -231,7 +231,7 @@ __json_struct_unpackv(WT_SESSION_IMPL *session, /* Unpacking a cursor marked as json implies a single arg. */ *va_arg(ap, const char **) = (char *)jbuf; - WT_RET(__pack_name_init(session, names, iskey, &packname)); + __pack_name_init(session, names, iskey, &packname); WT_RET(__pack_init(session, &pack, fmt)); while ((ret = __pack_next(&pack, &pv)) == 0) { if (needcr) { @@ -365,10 +365,10 @@ __wt_json_unpack_char(u_char ch, u_char *buf, size_t bufsz, bool force_unicode) /* * __wt_json_column_init -- - * set json_key_names, json_value_names to comma separated lists + * Set json_key_names, json_value_names to comma separated lists * of column names. */ -int +void __wt_json_column_init(WT_CURSOR *cursor, const char *keyformat, const WT_CONFIG_ITEM *idxconf, const WT_CONFIG_ITEM *colconf) { @@ -408,7 +408,6 @@ __wt_json_column_init(WT_CURSOR *cursor, const char *keyformat, json->key_names.str = beginkey; json->key_names.len = WT_PTRDIFF(p, beginkey); } - return (0); } #define MATCH_KEYWORD(session, in, result, keyword, matchval) do { \ @@ -774,7 +773,7 @@ __json_pack_size( bool multi; const char *tokstart; - WT_RET(__pack_name_init(session, names, iskey, &packname)); + __pack_name_init(session, names, iskey, &packname); multi = false; WT_RET(__pack_init(session, &pack, fmt)); for (total = 0; __pack_next(&pack, &pv) == 0;) { diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c index a14b40a1150..0498c89fcbe 100644 --- a/src/cursor/cur_table.c +++ b/src/cursor/cur_table.c @@ -938,8 +938,8 @@ __wt_curtable_open(WT_SESSION_IMPL *session, cursor, cursor->internal_uri, owner, cfg, cursorp)); if (F_ISSET(cursor, WT_CURSTD_DUMP_JSON)) - WT_ERR(__wt_json_column_init(cursor, table->key_format, - NULL, &table->colconf)); + __wt_json_column_init( + cursor, table->key_format, NULL, &table->colconf); /* * Open the colgroup cursors immediately: we're going to need them for diff --git a/src/include/extern.h b/src/include/extern.h index 524245c7b63..e5af4c62763 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -80,9 +80,9 @@ extern int __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM * extern int __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, wt_off_t *offsetp, uint32_t *sizep, uint32_t *cksump, bool data_cksum, bool checkpoint_io, bool caller_locked) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_bloom_create( WT_SESSION_IMPL *session, const char *uri, const char *config, uint64_t count, uint32_t factor, uint32_t k, WT_BLOOM **bloomp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_bloom_open(WT_SESSION_IMPL *session, const char *uri, uint32_t factor, uint32_t k, WT_CURSOR *owner, WT_BLOOM **bloomp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_bloom_insert(WT_BLOOM *bloom, WT_ITEM *key); extern int __wt_bloom_finalize(WT_BLOOM *bloom) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_bloom_hash(WT_BLOOM *bloom, WT_ITEM *key, WT_BLOOM_HASH *bhash) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_bloom_hash(WT_BLOOM *bloom, WT_ITEM *key, WT_BLOOM_HASH *bhash); extern int __wt_bloom_hash_get(WT_BLOOM *bloom, WT_BLOOM_HASH *bhash) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_bloom_get(WT_BLOOM *bloom, WT_ITEM *key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_bloom_inmem_get(WT_BLOOM *bloom, WT_ITEM *key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -199,14 +199,14 @@ extern int __wt_las_destroy(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE extern void __wt_las_set_written(WT_SESSION_IMPL *session); extern bool __wt_las_is_written(WT_SESSION_IMPL *session); extern int __wt_las_cursor_open(WT_SESSION_IMPL *session, WT_CURSOR **cursorp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_las_cursor( WT_SESSION_IMPL *session, WT_CURSOR **cursorp, uint32_t *session_flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_las_cursor( WT_SESSION_IMPL *session, WT_CURSOR **cursorp, uint32_t *session_flags); extern int __wt_las_cursor_close( WT_SESSION_IMPL *session, WT_CURSOR **cursorp, uint32_t session_flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_las_sweep(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern uint32_t __wt_cksum(const void *chunk, size_t len); extern void __wt_cksum_init(void); -extern int __wt_config_initn( WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str, size_t len) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_config_init(WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_config_subinit( WT_SESSION_IMPL *session, WT_CONFIG *conf, WT_CONFIG_ITEM *item) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_config_initn( WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str, size_t len); +extern void __wt_config_init(WT_SESSION_IMPL *session, WT_CONFIG *conf, const char *str); +extern void __wt_config_subinit( WT_SESSION_IMPL *session, WT_CONFIG *conf, WT_CONFIG_ITEM *item); extern int __wt_config_next(WT_CONFIG *conf, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_config_get(WT_SESSION_IMPL *session, const char **cfg_arg, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_config_gets(WT_SESSION_IMPL *session, const char **cfg, const char *key, WT_CONFIG_ITEM *value) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -290,7 +290,7 @@ extern int __wt_curjoin_join(WT_SESSION_IMPL *session, WT_CURSOR_JOIN *cjoin, WT extern int __wt_json_alloc_unpack(WT_SESSION_IMPL *session, const void *buffer, size_t size, const char *fmt, WT_CURSOR_JSON *json, bool iskey, va_list ap) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_json_close(WT_SESSION_IMPL *session, WT_CURSOR *cursor); extern size_t __wt_json_unpack_char(u_char ch, u_char *buf, size_t bufsz, bool force_unicode); -extern int __wt_json_column_init(WT_CURSOR *cursor, const char *keyformat, const WT_CONFIG_ITEM *idxconf, const WT_CONFIG_ITEM *colconf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_json_column_init(WT_CURSOR *cursor, const char *keyformat, const WT_CONFIG_ITEM *idxconf, const WT_CONFIG_ITEM *colconf); extern int __wt_json_token(WT_SESSION *wt_session, const char *src, int *toktype, const char **tokstart, size_t *toklen) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern const char *__wt_json_tokname(int toktype); extern int __wt_json_to_item(WT_SESSION_IMPL *session, const char *jstr, const char *format, WT_CURSOR_JSON *json, bool iskey, WT_ITEM *item) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -471,7 +471,7 @@ extern int __wt_metadata_search(WT_SESSION_IMPL *session, const char *key, char extern void __wt_meta_track_discard(WT_SESSION_IMPL *session); extern int __wt_meta_track_on(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_track_off(WT_SESSION_IMPL *session, bool need_sync, bool unroll) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_meta_track_sub_on(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_meta_track_sub_on(WT_SESSION_IMPL *session); extern int __wt_meta_track_sub_off(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_track_checkpoint(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_track_insert(WT_SESSION_IMPL *session, const char *key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -505,7 +505,7 @@ extern int __wt_close(WT_SESSION_IMPL *session, WT_FH **fhp) WT_GCC_FUNC_DECL_AT extern int __wt_close_connection_close(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_os_inmemory(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_fopen(WT_SESSION_IMPL *session, const char *name, uint32_t open_flags, uint32_t flags, WT_FSTREAM **fstrp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_os_stdio(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_os_stdio(WT_SESSION_IMPL *session); extern int __wt_getopt( const char *progname, int nargc, char *const *nargv, const char *ostr) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern uint64_t __wt_strtouq(const char *nptr, char **endptr, int base); extern int __wt_ext_struct_pack(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, void *buffer, size_t size, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -658,7 +658,7 @@ extern int __wt_nhex_to_raw( WT_SESSION_IMPL *session, const char *from, size_t extern int __wt_esc_hex_to_raw(WT_SESSION_IMPL *session, const char *from, WT_ITEM *to) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_huffman_open(WT_SESSION_IMPL *session, void *symbol_frequency_array, u_int symcnt, u_int numbytes, void *retp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_huffman_close(WT_SESSION_IMPL *session, void *huffman_arg); -extern int __wt_print_huffman_code(void *huffman_arg, uint16_t symbol) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_print_huffman_code(void *huffman_arg, uint16_t symbol); extern int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, size_t from_len, WT_ITEM *to_buf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, size_t from_len, WT_ITEM *to_buf) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_rwlock_alloc( WT_SESSION_IMPL *session, WT_RWLOCK **rwlockp, const char *name) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -743,11 +743,11 @@ extern int __wt_txn_log_commit(WT_SESSION_IMPL *session, const char *cfg[]) WT_G extern int __wt_txn_checkpoint_logread( WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, WT_LSN *ckpt_lsn) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_checkpoint_log( WT_SESSION_IMPL *session, bool full, uint32_t flags, WT_LSN *lsnp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_truncate_log( WT_SESSION_IMPL *session, WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_txn_truncate_end(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_txn_truncate_end(WT_SESSION_IMPL *session); extern int __wt_txn_printlog(WT_SESSION *wt_session, uint32_t flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_named_snapshot_begin(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_named_snapshot_drop(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_named_snapshot_get(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *nameval) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_named_snapshot_config(WT_SESSION_IMPL *session, const char *cfg[], bool *has_create, bool *has_drops) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern void __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session); extern int __wt_txn_recover(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/include/packing.i b/src/include/packing.i index d662c60d221..17ca261bcfc 100644 --- a/src/include/packing.i +++ b/src/include/packing.i @@ -81,7 +81,7 @@ __pack_init(WT_SESSION_IMPL *session, WT_PACK *pack, const char *fmt) * __pack_name_init -- * Initialize the name of a pack iterator. */ -static inline int +static inline void __pack_name_init(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *names, bool iskey, WT_PACK_NAME *pn) { @@ -89,11 +89,9 @@ __pack_name_init(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *names, pn->iskey = iskey; if (names->str != NULL) - WT_RET(__wt_config_subinit(session, &pn->config, names)); + __wt_config_subinit(session, &pn->config, names); else pn->genname = 1; - - return (0); } /* diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index 78d77884d40..bf591d8dbe6 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -1074,8 +1074,7 @@ __clsm_lookup(WT_CURSOR_LSM *clsm, WT_ITEM *value) bloom = NULL; if ((bloom = clsm->blooms[i]) != NULL) { if (!have_hash) { - WT_ERR(__wt_bloom_hash( - bloom, &cursor->key, &bhash)); + __wt_bloom_hash(bloom, &cursor->key, &bhash); have_hash = true; } diff --git a/src/lsm/lsm_merge.c b/src/lsm/lsm_merge.c index ccad6c90449..2276631af1e 100644 --- a/src/lsm/lsm_merge.c +++ b/src/lsm/lsm_merge.c @@ -43,12 +43,11 @@ __wt_lsm_merge_update_tree(WT_SESSION_IMPL *session, * __lsm_merge_aggressive_clear -- * We found a merge to do - clear the aggressive timer. */ -static int +static void __lsm_merge_aggressive_clear(WT_LSM_TREE *lsm_tree) { F_CLR(lsm_tree, WT_LSM_TREE_AGGRESSIVE_TIMER); lsm_tree->merge_aggressiveness = 0; - return (0); } /* @@ -80,8 +79,10 @@ __lsm_merge_aggressive_update(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) * Only get aggressive if a reasonable number of flushes have been * completed since opening the tree. */ - if (lsm_tree->chunks_flushed <= lsm_tree->merge_min) - return (__lsm_merge_aggressive_clear(lsm_tree)); + if (lsm_tree->chunks_flushed <= lsm_tree->merge_min) { + __lsm_merge_aggressive_clear(lsm_tree); + return (0); + } /* * Start the timer if it isn't running. Use a flag to define whether @@ -329,7 +330,7 @@ retry_find: return (WT_NOTFOUND); } - WT_RET(__lsm_merge_aggressive_clear(lsm_tree)); + __lsm_merge_aggressive_clear(lsm_tree); *records = record_count; *start = start_chunk; *end = end_chunk; @@ -471,7 +472,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id) dest->set_value(dest, &value); WT_ERR(dest->insert(dest)); if (create_bloom) - WT_ERR(__wt_bloom_insert(bloom, &key)); + __wt_bloom_insert(bloom, &key); } WT_ERR_NOTFOUND_OK(ret); diff --git a/src/lsm/lsm_meta.c b/src/lsm/lsm_meta.c index 7e100cb855c..ec52af96231 100644 --- a/src/lsm/lsm_meta.c +++ b/src/lsm/lsm_meta.c @@ -28,15 +28,15 @@ __lsm_meta_read_v0( if (F_ISSET(S2C(session), WT_CONN_LSM_MERGE)) F_SET(lsm_tree, WT_LSM_TREE_MERGES); - WT_ERR(__wt_config_init(session, &cparser, lsmconf)); + __wt_config_init(session, &cparser, lsmconf); while ((ret = __wt_config_next(&cparser, &ck, &cv)) == 0) { if (WT_STRING_MATCH("key_format", ck.str, ck.len)) { __wt_free(session, lsm_tree->key_format); - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str, cv.len, &lsm_tree->key_format)); } else if (WT_STRING_MATCH("value_format", ck.str, ck.len)) { __wt_free(session, lsm_tree->value_format); - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str, cv.len, &lsm_tree->value_format)); } else if (WT_STRING_MATCH("collator", ck.str, ck.len)) { if (cv.len == 0 || @@ -46,25 +46,25 @@ __lsm_meta_read_v0( * Extract the application-supplied metadata (if any) * from the file configuration. */ - WT_ERR(__wt_config_getones( + WT_RET(__wt_config_getones( session, lsmconf, "file_config", &fileconf)); WT_CLEAR(metadata); - WT_ERR_NOTFOUND_OK(__wt_config_subgets( + WT_RET_NOTFOUND_OK(__wt_config_subgets( session, &fileconf, "app_metadata", &metadata)); - WT_ERR(__wt_collator_config(session, lsm_tree->name, + WT_RET(__wt_collator_config(session, lsm_tree->name, &cv, &metadata, &lsm_tree->collator, &lsm_tree->collator_owned)); - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str, cv.len, &lsm_tree->collator_name)); } else if (WT_STRING_MATCH("bloom_config", ck.str, ck.len)) { __wt_free(session, lsm_tree->bloom_config); /* Don't include the brackets. */ - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str + 1, cv.len - 2, &lsm_tree->bloom_config)); } else if (WT_STRING_MATCH("file_config", ck.str, ck.len)) { __wt_free(session, lsm_tree->file_config); /* Don't include the brackets. */ - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, cv.str + 1, cv.len - 2, &lsm_tree->file_config)); } else if (WT_STRING_MATCH("auto_throttle", ck.str, ck.len)) { if (cv.val) @@ -92,25 +92,25 @@ __lsm_meta_read_v0( else if (WT_STRING_MATCH("last", ck.str, ck.len)) lsm_tree->last = (u_int)cv.val; else if (WT_STRING_MATCH("chunks", ck.str, ck.len)) { - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("id", lk.str, lk.len)) { - WT_ERR(__wt_realloc_def(session, + WT_RET(__wt_realloc_def(session, &lsm_tree->chunk_alloc, nchunks + 1, &lsm_tree->chunk)); - WT_ERR( + WT_RET( __wt_calloc_one(session, &chunk)); lsm_tree->chunk[nchunks++] = chunk; chunk->id = (uint32_t)lv.val; - WT_ERR(__wt_lsm_tree_chunk_name(session, + WT_RET(__wt_lsm_tree_chunk_name(session, lsm_tree, chunk->id, &chunk->uri)); F_SET(chunk, WT_LSM_CHUNK_ONDISK | WT_LSM_CHUNK_STABLE); } else if (WT_STRING_MATCH( "bloom", lk.str, lk.len)) { - WT_ERR(__wt_lsm_tree_bloom_name( + WT_RET(__wt_lsm_tree_bloom_name( session, lsm_tree, chunk->id, &chunk->bloom_uri)); F_SET(chunk, WT_LSM_CHUNK_BLOOM); @@ -129,28 +129,28 @@ __lsm_meta_read_v0( continue; } } - WT_ERR_NOTFOUND_OK(ret); + WT_RET_NOTFOUND_OK(ret); lsm_tree->nchunks = nchunks; } else if (WT_STRING_MATCH("old_chunks", ck.str, ck.len)) { - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("bloom", lk.str, lk.len)) { - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, lv.str, lv.len, &chunk->bloom_uri)); F_SET(chunk, WT_LSM_CHUNK_BLOOM); continue; } - WT_ERR(__wt_realloc_def(session, + WT_RET(__wt_realloc_def(session, &lsm_tree->old_alloc, nchunks + 1, &lsm_tree->old_chunks)); - WT_ERR(__wt_calloc_one(session, &chunk)); + WT_RET(__wt_calloc_one(session, &chunk)); lsm_tree->old_chunks[nchunks++] = chunk; - WT_ERR(__wt_strndup(session, + WT_RET(__wt_strndup(session, lk.str, lk.len, &chunk->uri)); F_SET(chunk, WT_LSM_CHUNK_ONDISK); } - WT_ERR_NOTFOUND_OK(ret); + WT_RET_NOTFOUND_OK(ret); lsm_tree->nold_chunks = nchunks; } /* @@ -158,8 +158,8 @@ __lsm_meta_read_v0( * created by a future release, with unknown options. */ } - WT_ERR_NOTFOUND_OK(ret); -err: return (ret); + WT_RET_NOTFOUND_OK(ret); + return (0); } /* @@ -264,7 +264,7 @@ __lsm_meta_read_v1( WT_ERR(__wt_config_getones(session, lsmconf, "last", &cv)); lsm_tree->last = (u_int)cv.val; WT_ERR(__wt_config_getones(session, lsmconf, "chunks", &cv)); - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("id", lk.str, lk.len)) { @@ -299,7 +299,7 @@ __lsm_meta_read_v1( lsm_tree->nchunks = nchunks; WT_ERR(__wt_config_getones(session, lsmconf, "old_chunks", &cv)); - WT_ERR(__wt_config_subinit(session, &lparser, &cv)); + __wt_config_subinit(session, &lparser, &cv); for (nchunks = 0; (ret = __wt_config_next(&lparser, &lk, &lv)) == 0; ) { if (WT_STRING_MATCH("bloom", lk.str, lk.len)) { @@ -404,6 +404,7 @@ __lsm_meta_upgrade_v1(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) err: __wt_scr_free(session, &buf); return (ret); } + /* * __wt_lsm_meta_read -- * Read the metadata for an LSM tree. diff --git a/src/lsm/lsm_work_unit.c b/src/lsm/lsm_work_unit.c index bfca09b3807..72bcf56b3c4 100644 --- a/src/lsm/lsm_work_unit.c +++ b/src/lsm/lsm_work_unit.c @@ -447,7 +447,7 @@ __lsm_bloom_create(WT_SESSION_IMPL *session, F_SET(session, WT_SESSION_NO_CACHE | WT_SESSION_NO_EVICTION); for (insert_count = 0; (ret = src->next(src)) == 0; insert_count++) { WT_ERR(src->get_key(src, &key)); - WT_ERR(__wt_bloom_insert(bloom, &key)); + __wt_bloom_insert(bloom, &key); } WT_ERR_NOTFOUND_OK(ret); WT_TRET(src->close(src)); diff --git a/src/meta/meta_ckpt.c b/src/meta/meta_ckpt.c index 0a864432daf..2b7719c3241 100644 --- a/src/meta/meta_ckpt.c +++ b/src/meta/meta_ckpt.c @@ -139,7 +139,7 @@ __ckpt_named(WT_SESSION_IMPL *session, WT_CONFIG_ITEM k, v; WT_RET(__wt_config_getones(session, config, "checkpoint", &v)); - WT_RET(__wt_config_subinit(session, &ckptconf, &v)); + __wt_config_subinit(session, &ckptconf, &v); /* * Take the first match: there should never be more than a single @@ -164,7 +164,7 @@ __ckpt_last(WT_SESSION_IMPL *session, const char *config, WT_CKPT *ckpt) int64_t found; WT_RET(__wt_config_getones(session, config, "checkpoint", &v)); - WT_RET(__wt_config_subinit(session, &ckptconf, &v)); + __wt_config_subinit(session, &ckptconf, &v); for (found = 0; __wt_config_next(&ckptconf, &k, &v) == 0;) { /* Ignore checkpoints before the ones we've already seen. */ WT_RET(__wt_config_subgets(session, &v, "order", &a)); @@ -196,7 +196,7 @@ __ckpt_last_name( *namep = NULL; WT_ERR(__wt_config_getones(session, config, "checkpoint", &v)); - WT_ERR(__wt_config_subinit(session, &ckptconf, &v)); + __wt_config_subinit(session, &ckptconf, &v); for (found = 0; __wt_config_next(&ckptconf, &k, &v) == 0;) { /* * We only care about unnamed checkpoints; applications may not @@ -267,8 +267,8 @@ __wt_meta_ckptlist_get( /* Load any existing checkpoints into the array. */ WT_ERR(__wt_scr_alloc(session, 0, &buf)); - if (__wt_config_getones(session, config, "checkpoint", &v) == 0 && - __wt_config_subinit(session, &ckptconf, &v) == 0) + if (__wt_config_getones(session, config, "checkpoint", &v) == 0) { + __wt_config_subinit(session, &ckptconf, &v); for (; __wt_config_next(&ckptconf, &k, &v) == 0; ++slot) { WT_ERR(__wt_realloc_def( session, &allocated, slot + 1, &ckptbase)); @@ -276,6 +276,7 @@ __wt_meta_ckptlist_get( WT_ERR(__ckpt_load(session, &k, &v, ckpt)); } + } /* * Allocate an extra slot for a new value, plus a slot to mark the end. diff --git a/src/meta/meta_track.c b/src/meta/meta_track.c index 3d8b7c46500..9655a0b26a7 100644 --- a/src/meta/meta_track.c +++ b/src/meta/meta_track.c @@ -310,12 +310,11 @@ done: /* Apply any tracked operations post-commit. */ * Start a group of operations that can be committed independent of the * main transaction. */ -int +void __wt_meta_track_sub_on(WT_SESSION_IMPL *session) { WT_ASSERT(session, session->meta_track_sub == NULL); session->meta_track_sub = session->meta_track_next; - return (0); } /* diff --git a/src/os_common/os_fstream_stdio.c b/src/os_common/os_fstream_stdio.c index eea2c80ff0e..0cc75e109a1 100644 --- a/src/os_common/os_fstream_stdio.c +++ b/src/os_common/os_fstream_stdio.c @@ -74,11 +74,9 @@ __stdio_init(WT_FSTREAM *fs, const char *name, FILE *fp) * __wt_os_stdio -- * Initialize the stdio configuration. */ -int +void __wt_os_stdio(WT_SESSION_IMPL *session) { __stdio_init(WT_STDERR(session), "stderr", stderr); __stdio_init(WT_STDOUT(session), "stdout", stdout); - - return (0); } diff --git a/src/reconcile/rec_track.c b/src/reconcile/rec_track.c index ada2096a937..10a64fdf116 100644 --- a/src/reconcile/rec_track.c +++ b/src/reconcile/rec_track.c @@ -108,7 +108,7 @@ __ovfl_discard_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) * __ovfl_discard_wrapup_err -- * Resolve the page's overflow discard list after an error occurs. */ -static int +static void __ovfl_discard_wrapup_err(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_OVFL_TRACK *track; @@ -117,8 +117,6 @@ __ovfl_discard_wrapup_err(WT_SESSION_IMPL *session, WT_PAGE *page) __wt_free(session, track->discard); track->discard_entries = track->discard_allocated = 0; - - return (0); } /* @@ -903,7 +901,7 @@ __wt_ovfl_track_wrapup_err(WT_SESSION_IMPL *session, WT_PAGE *page) track = page->modify->ovfl_track; if (track->discard != NULL) - WT_RET(__ovfl_discard_wrapup_err(session, page)); + __ovfl_discard_wrapup_err(session, page); if (track->ovfl_reuse[0] != NULL) WT_RET(__ovfl_reuse_wrapup_err(session, page)); diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index edfd4e0a947..c29c4c7407f 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -3406,7 +3406,7 @@ __rec_update_las(WT_SESSION_IMPL *session, */ __wt_las_set_written(session); - WT_ERR(__wt_las_cursor(session, &cursor, &session_flags)); + __wt_las_cursor(session, &cursor, &session_flags); /* Ensure enough room for a column-store key without checking. */ WT_ERR(__wt_scr_alloc(session, WT_INTPACK64_MAXSIZE, &key)); diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c index f250612d0ae..ed88e687a19 100644 --- a/src/schema/schema_create.c +++ b/src/schema/schema_create.c @@ -446,7 +446,7 @@ __create_index(WT_SESSION_IMPL *session, */ npublic_cols = 0; if (!have_extractor) { - WT_ERR(__wt_config_subinit(session, &kcols, &icols)); + __wt_config_subinit(session, &kcols, &icols); while ((ret = __wt_config_next(&kcols, &ckey, &cval)) == 0) ++npublic_cols; WT_ERR_NOTFOUND_OK(ret); @@ -465,7 +465,7 @@ __create_index(WT_SESSION_IMPL *session, * key_format, which we are calculating now, but not part of an index * cursor's key_format. */ - WT_ERR(__wt_config_subinit(session, &pkcols, &table->colconf)); + __wt_config_subinit(session, &pkcols, &table->colconf); for (i = 0; i < table->nkey_columns && (ret = __wt_config_next(&pkcols, &ckey, &cval)) == 0; i++) { @@ -581,7 +581,7 @@ __create_table(WT_SESSION_IMPL *session, WT_ERR_NOTFOUND_OK(ret); WT_ERR(__wt_config_gets(session, cfg, "colgroups", &cval)); - WT_ERR(__wt_config_subinit(session, &conf, &cval)); + __wt_config_subinit(session, &conf, &cval); for (ncolgroups = 0; (ret = __wt_config_next(&conf, &cgkey, &cgval)) == 0; ncolgroups++) diff --git a/src/schema/schema_open.c b/src/schema/schema_open.c index 1554d021953..44bd66e011a 100644 --- a/src/schema/schema_open.c +++ b/src/schema/schema_open.c @@ -54,7 +54,7 @@ __wt_schema_open_colgroups(WT_SESSION_IMPL *session, WT_TABLE *table) WT_RET(__wt_scr_alloc(session, 0, &buf)); - WT_ERR(__wt_config_subinit(session, &cparser, &table->cgconf)); + __wt_config_subinit(session, &cparser, &table->cgconf); /* Open each column group. */ for (i = 0; i < WT_COLGROUPS(table); i++) { @@ -175,7 +175,7 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx) session, idx->config, "columns", &idx->colconf)); /* Start with the declared index columns. */ - WT_ERR(__wt_config_subinit(session, &colconf, &idx->colconf)); + __wt_config_subinit(session, &colconf, &idx->colconf); for (npublic_cols = 0; (ret = __wt_config_next(&colconf, &ckey, &cval)) == 0; ++npublic_cols) @@ -202,7 +202,7 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, WT_INDEX *idx) * Now add any primary key columns from the table that are not * already part of the index key. */ - WT_ERR(__wt_config_subinit(session, &colconf, &table->colconf)); + __wt_config_subinit(session, &colconf, &table->colconf); for (i = 0; i < table->nkey_columns && (ret = __wt_config_next(&colconf, &ckey, &cval)) == 0; i++) { @@ -465,7 +465,7 @@ __schema_open_table(WT_SESSION_IMPL *session, * Count the number of columns: tables are "simple" if the columns * are not named. */ - WT_ERR(__wt_config_subinit(session, &cparser, &table->colconf)); + __wt_config_subinit(session, &cparser, &table->colconf); table->is_simple = true; while ((ret = __wt_config_next(&cparser, &ckey, &cval)) == 0) table->is_simple = false; @@ -482,7 +482,7 @@ __schema_open_table(WT_SESSION_IMPL *session, "colgroups", &table->cgconf)); /* Count the number of column groups. */ - WT_ERR(__wt_config_subinit(session, &cparser, &table->cgconf)); + __wt_config_subinit(session, &cparser, &table->cgconf); table->ncolgroups = 0; while ((ret = __wt_config_next(&cparser, &ckey, &cval)) == 0) ++table->ncolgroups; diff --git a/src/schema/schema_plan.c b/src/schema/schema_plan.c index 12a1aa9c22f..475902be887 100644 --- a/src/schema/schema_plan.c +++ b/src/schema/schema_plan.c @@ -45,7 +45,7 @@ __find_next_col(WT_SESSION_IMPL *session, WT_TABLE *table, cgcols: cval = colgroup->colconf; col = table->nkey_columns; } - WT_RET(__wt_config_subinit(session, &conf, &cval)); + __wt_config_subinit(session, &conf, &cval); for (; (ret = __wt_config_next(&conf, &k, &v)) == 0; col++) { if (k.len == colname->len && strncmp(colname->str, k.str, k.len) == 0) { @@ -105,7 +105,7 @@ __wt_schema_colcheck(WT_SESSION_IMPL *session, WT_RET_TEST(ret != WT_NOTFOUND, ret); /* Walk through the named columns. */ - WT_RET(__wt_config_subinit(session, &conf, colconf)); + __wt_config_subinit(session, &conf, colconf); for (ncols = 0; (ret = __wt_config_next(&conf, &k, &v)) == 0; ncols++) ; WT_RET_TEST(ret != WT_NOTFOUND, ret); @@ -140,7 +140,7 @@ __wt_table_check(WT_SESSION_IMPL *session, WT_TABLE *table) return (0); /* Walk through the columns. */ - WT_RET(__wt_config_subinit(session, &conf, &table->colconf)); + __wt_config_subinit(session, &conf, &table->colconf); /* Skip over the key columns. */ for (i = 0; i < table->nkey_columns; i++) @@ -186,7 +186,7 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, start_cg = start_col = UINT_MAX; /* -Wuninitialized */ /* Work through the value columns by skipping over the key columns. */ - WT_RET(__wt_config_initn(session, &conf, columns, len)); + __wt_config_initn(session, &conf, columns, len); if (value_only) for (i = 0; i < table->nkey_columns; i++) WT_RET(__wt_config_next(&conf, &k, &v)); @@ -281,7 +281,7 @@ __find_column_format(WT_SESSION_IMPL *session, WT_TABLE *table, WT_PACK pack; bool inkey; - WT_RET(__wt_config_subinit(session, &conf, &table->colconf)); + __wt_config_subinit(session, &conf, &table->colconf); WT_RET(__pack_init(session, &pack, table->key_format)); inkey = true; @@ -323,7 +323,7 @@ __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, WT_DECL_RET; bool have_next; - WT_RET(__wt_config_initn(session, &config, columns, len)); + __wt_config_initn(session, &config, columns, len); /* * If an empty column list is specified, this will fail with * WT_NOTFOUND, that's okay. @@ -331,7 +331,7 @@ __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, WT_RET_NOTFOUND_OK(ret = __wt_config_next(&config, &next_k, &next_v)); if (ret == WT_NOTFOUND) { if (extra_cols != NULL) { - WT_RET(__wt_config_init(session, &config, extra_cols)); + __wt_config_init(session, &config, extra_cols); WT_RET(__wt_config_next(&config, &next_k, &next_v)); extra_cols = NULL; } else if (format->size == 0) { @@ -347,7 +347,7 @@ __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, have_next = ret == 0; if (!have_next && extra_cols != NULL) { - WT_RET(__wt_config_init(session, &config, extra_cols)); + __wt_config_init(session, &config, extra_cols); WT_RET(__wt_config_next(&config, &next_k, &next_v)); have_next = true; extra_cols = NULL; diff --git a/src/schema/schema_stat.c b/src/schema/schema_stat.c index c204d6b1a24..1cd39d97364 100644 --- a/src/schema/schema_stat.c +++ b/src/schema/schema_stat.c @@ -83,7 +83,7 @@ __curstat_size_only(WT_SESSION_IMPL *session, * we determine that neither of those conditions can be satisfied. */ WT_ERR(__wt_config_getones(session, tableconf, "columns", &colconf)); - WT_ERR(__wt_config_subinit(session, &cparser, &colconf)); + __wt_config_subinit(session, &cparser, &colconf); if ((ret = __wt_config_next(&cparser, &ckey, &cval)) == 0) goto err; diff --git a/src/support/huffman.c b/src/support/huffman.c index 05612cdbe80..3ec282915ca 100644 --- a/src/support/huffman.c +++ b/src/support/huffman.c @@ -560,7 +560,7 @@ __wt_huffman_close(WT_SESSION_IMPL *session, void *huffman_arg) * __wt_print_huffman_code -- * Prints a symbol's Huffman code. */ -int +void __wt_print_huffman_code(void *huffman_arg, uint16_t symbol) { WT_HUFFMAN_CODE code; @@ -583,8 +583,6 @@ __wt_print_huffman_code(void *huffman_arg, uint16_t symbol) "%" PRIx16 ", length %" PRIu8 "\n", symbol, code.pattern, code.length); } - - return (0); } #endif diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c index 5406367c372..98ebcd24922 100644 --- a/src/txn/txn_ckpt.c +++ b/src/txn/txn_ckpt.c @@ -113,7 +113,7 @@ __checkpoint_apply_all(WT_SESSION_IMPL *session, const char *cfg[], /* Step through the targets and optionally operate on each one. */ WT_ERR(__wt_config_gets(session, cfg, "target", &cval)); - WT_ERR(__wt_config_subinit(session, &targetconf, &cval)); + __wt_config_subinit(session, &targetconf, &cval); while ((ret = __wt_config_next(&targetconf, &k, &v)) == 0) { if (!target_list) { WT_ERR(__wt_scr_alloc(session, 512, &tmp)); @@ -1054,7 +1054,7 @@ __checkpoint_lock_tree(WT_SESSION_IMPL *session, cval.len = 0; WT_ERR(__wt_config_gets(session, cfg, "drop", &cval)); if (cval.len != 0) { - WT_ERR(__wt_config_subinit(session, &dropconf, &cval)); + __wt_config_subinit(session, &dropconf, &cval); while ((ret = __wt_config_next(&dropconf, &k, &v)) == 0) { /* Disallow unsafe checkpoint names. */ diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c index c7d83d1db64..f9dd9bee807 100644 --- a/src/txn/txn_log.c +++ b/src/txn/txn_log.c @@ -450,11 +450,10 @@ __wt_txn_truncate_log( * __wt_txn_truncate_end -- * Finish truncating a range of a file. */ -int +void __wt_txn_truncate_end(WT_SESSION_IMPL *session) { F_CLR(session, WT_SESSION_LOGGING_INMEM); - return (0); } /* diff --git a/src/txn/txn_nsnap.c b/src/txn/txn_nsnap.c index 05c45c0dc38..d0110d9edd8 100644 --- a/src/txn/txn_nsnap.c +++ b/src/txn/txn_nsnap.c @@ -220,8 +220,7 @@ __wt_txn_named_snapshot_drop(WT_SESSION_IMPL *session, const char *cfg[]) /* We are done if there are no named drops */ if (names_config.len != 0) { - WT_RET(__wt_config_subinit( - session, &objectconf, &names_config)); + __wt_config_subinit(session, &objectconf, &names_config); while ((ret = __wt_config_next(&objectconf, &k, &v)) == 0) { ret = __nsnap_drop_one(session, &k); if (ret != 0) @@ -352,7 +351,7 @@ __wt_txn_named_snapshot_config(WT_SESSION_IMPL *session, * __wt_txn_named_snapshot_destroy -- * Destroy all named snapshots on connection close */ -int +void __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session) { WT_NAMED_SNAPSHOT *nsnap; @@ -365,6 +364,4 @@ __wt_txn_named_snapshot_destroy(WT_SESSION_IMPL *session) TAILQ_REMOVE(&txn_global->nsnaph, nsnap, q); __nsnap_destroy(session, nsnap); } - - return (0); } diff --git a/test/bloom/test_bloom.c b/test/bloom/test_bloom.c index 9a7584f951f..7a298f000aa 100644 --- a/test/bloom/test_bloom.c +++ b/test/bloom/test_bloom.c @@ -160,8 +160,7 @@ run(void) item.size = g.c_key_max; for (i = 0; i < g.c_ops; i++) { item.data = g.entries[i]; - if ((ret = __wt_bloom_insert(bloomp, &item)) != 0) - testutil_die(ret, "__wt_bloom_insert: %" PRIu32, i); + __wt_bloom_insert(bloomp, &item); } testutil_check(__wt_bloom_finalize(bloomp)); diff --git a/test/checkpoint/test_checkpoint.c b/test/checkpoint/test_checkpoint.c index 6293d36f916..6b2f0d4466c 100644 --- a/test/checkpoint/test_checkpoint.c +++ b/test/checkpoint/test_checkpoint.c @@ -34,7 +34,7 @@ static int handle_error(WT_EVENT_HANDLER *, WT_SESSION *, int, const char *); static int handle_message(WT_EVENT_HANDLER *, WT_SESSION *, const char *); static void onint(int) WT_GCC_FUNC_DECL_ATTRIBUTE((noreturn)); -static int cleanup(void); +static void cleanup(void); static int usage(void); static int wt_connect(const char *); static int wt_shutdown(void); @@ -139,7 +139,7 @@ main(int argc, char *argv[]) printf(" %d: %d workers, %d tables\n", cnt, g.nworkers, g.ntables); - (void)cleanup(); /* Clean up previous runs */ + cleanup(); /* Clean up previous runs */ /* Setup a fresh set of cookies in the global array. */ if ((g.cookies = calloc( @@ -240,14 +240,13 @@ wt_shutdown(void) * cleanup -- * Clean up from previous runs. */ -static int +static void cleanup(void) { g.running = 0; g.ntables_created = 0; testutil_clean_work_dir(g.home); - return (0); } static int @@ -283,7 +282,7 @@ onint(int signo) { WT_UNUSED(signo); - (void)cleanup(); + cleanup(); fprintf(stderr, "\n"); exit(EXIT_FAILURE); diff --git a/test/csuite/wt2853_perf/main.c b/test/csuite/wt2853_perf/main.c index 016b7500145..67ba4a20ada 100644 --- a/test/csuite/wt2853_perf/main.c +++ b/test/csuite/wt2853_perf/main.c @@ -186,7 +186,8 @@ main(int argc, char *argv[]) return (0); } -static void *thread_insert(void *arg) +static void * +thread_insert(void *arg) { TEST_OPTS *opts; THREAD_ARGS *threadargs; @@ -252,7 +253,8 @@ static void *thread_insert(void *arg) return (NULL); } -static void *thread_get(void *arg) +static void * +thread_get(void *arg) { SHARED_OPTS *sharedopts; TEST_OPTS *opts; diff --git a/test/manydbs/manydbs.c b/test/manydbs/manydbs.c index e485e73067f..c5c9a9a7ccd 100644 --- a/test/manydbs/manydbs.c +++ b/test/manydbs/manydbs.c @@ -93,7 +93,7 @@ get_stat(WT_SESSION *stat_session, int stat_field, uint64_t *valuep) return (ret); } -static int +static void run_ops(int dbs) { WT_ITEM data; @@ -119,7 +119,6 @@ run_ops(int dbs) testutil_check(cursors[db]->insert(cursors[db])); } } - return (0); } int @@ -211,7 +210,7 @@ main(int argc, char *argv[]) WT_STAT_CONN_COND_AUTO_WAIT_RESET, &cond_reset_orig[i])); for (i = 0; i < MAX_IDLE_TIME; i += IDLE_INCR) { if (!idle) - testutil_check(run_ops(dbs)); + run_ops(dbs); printf("Sleep %d (%d of %d)\n", IDLE_INCR, i, MAX_IDLE_TIME); sleep(IDLE_INCR); } |