diff options
-rw-r--r-- | dist/s_style | 24 | ||||
-rw-r--r-- | src/btree/bt_cursor.c | 6 | ||||
-rw-r--r-- | src/btree/bt_huffman.c | 4 | ||||
-rw-r--r-- | src/btree/bt_page.c | 6 | ||||
-rw-r--r-- | src/btree/bt_slvg.c | 2 | ||||
-rw-r--r-- | src/btree/rec_write.c | 6 | ||||
-rw-r--r-- | src/log/log.c | 8 | ||||
-rw-r--r-- | src/meta/meta_turtle.c | 7 |
8 files changed, 42 insertions, 21 deletions
diff --git a/dist/s_style b/dist/s_style index dd71c9b6678..ccd7214a2aa 100644 --- a/dist/s_style +++ b/dist/s_style @@ -4,7 +4,29 @@ t=__wt.$$ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 -cd .. && +cd .. + +# Returns in functions after a jump to error lable. +for f in `find examples ext src test -name '*.[ci]'`; do + sed -n \ + -e '/^__wt_conn_btree_close_all(/,/^}/d' \ + -e '/^__find_next_col(/,/^}/d' \ + -e '/^{$/,/^}$/{=;p;}' $f | + sed 'N;s/\n/:/' | + sed -e '/./{H;/^[0-9][0-9]*:}$/!d;}' \ + -e x \ + -e 's/\n/ /g' \ + -e 's/\/\*.*\*\///g' \ + -e p \ + -e '{s/.*//;x;}' | + egrep 'WT_ERR\(.*WT_RET.*err:|WT_ERR_MSG\(.*WT_RET.*err:|WT_ERR_TEST\(.*WT_RET.*err:|WT_ERR\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR_MSG\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR_TEST\(.*WT_ILLEGAL_VALUE\(.*err:' | + sed 's/:.*//' > $t + test -s $t && { + echo "$f: function with return after a jump to an error label" + sed 's/^/function @ line:/' < $t + } +done + for f in `find examples ext src test -name '*.[chisy]' -o -name '*.in' | sed '/Makefile.in/d'`; do if grep "^[^}]*while (0);" $f > $t; then diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index 209d1372e9e..61da774a1bd 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -306,7 +306,7 @@ retry: __cursor_func_init(cbt, 1); if ((ret = __wt_row_modify(session, cbt, 0)) == WT_RESTART) goto retry; break; - WT_ILLEGAL_VALUE(session); + WT_ILLEGAL_VALUE_ERR(session); } err: __cursor_func_resolve(cbt, ret); @@ -361,7 +361,7 @@ retry: __cursor_func_init(cbt, 1); else if ((ret = __wt_row_modify(session, cbt, 1)) == WT_RESTART) goto retry; break; - WT_ILLEGAL_VALUE(session); + WT_ILLEGAL_VALUE_ERR(session); } err: __cursor_func_resolve(cbt, ret); @@ -423,7 +423,7 @@ retry: __cursor_func_init(cbt, 1); else if ((ret = __wt_row_modify(session, cbt, 0)) == WT_RESTART) goto retry; break; - WT_ILLEGAL_VALUE(session); + WT_ILLEGAL_VALUE_ERR(session); } err: __cursor_func_resolve(cbt, ret); diff --git a/src/btree/bt_huffman.c b/src/btree/bt_huffman.c index 4afef022bbf..a5b65d61506 100644 --- a/src/btree/bt_huffman.c +++ b/src/btree/bt_huffman.c @@ -241,7 +241,7 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, if (strncasecmp(ip->str, "utf8", 4) == 0) { entries = UINT8_MAX; *numbytesp = 1; - WT_RET(__wt_calloc_def(session, entries, &table)); + WT_ERR(__wt_calloc_def(session, entries, &table)); if (ip->len == 4) WT_ERR_MSG(session, EINVAL, @@ -251,7 +251,7 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, } else if (strncasecmp(ip->str, "utf16", 5) == 0) { entries = UINT16_MAX; *numbytesp = 2; - WT_RET(__wt_calloc_def(session, entries, &table)); + WT_ERR(__wt_calloc_def(session, entries, &table)); if (ip->len == 5) WT_ERR_MSG(session, EINVAL, diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index 316d6539d88..c8c2d76a693 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -142,7 +142,7 @@ __wt_page_inmem(WT_SESSION_IMPL *session, case WT_PAGE_ROW_LEAF: WT_ERR(__inmem_row_leaf(session, page, &inmem_size)); break; - WT_ILLEGAL_VALUE(session); + WT_ILLEGAL_VALUE_ERR(session); } __wt_cache_page_read( @@ -323,7 +323,7 @@ __inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, size_t *inmem_sizep) * and location cookie). */ nindx = dsk->u.entries / 2; - WT_RET((__wt_calloc_def(session, (size_t)nindx, &page->u.intl.t))); + WT_ERR((__wt_calloc_def(session, (size_t)nindx, &page->u.intl.t))); if (inmem_sizep != NULL) *inmem_sizep += nindx * sizeof(*page->u.intl.t); @@ -361,7 +361,7 @@ __inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page, size_t *inmem_sizep) */ prefix = unpack->prefix; if (huffman != NULL || unpack->ovfl) { - WT_RET(__wt_cell_unpack_copy(session, unpack, current)); + WT_ERR(__wt_cell_unpack_copy(session, unpack, current)); /* * If there's a prefix, make sure there's enough buffer diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index c0e445e2e9a..e33f2e95fb2 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -413,7 +413,7 @@ __slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss) if (ss->page_type == WT_PAGE_INVALID) ss->page_type = dsk->type; if (ss->page_type != dsk->type) - WT_RET_MSG(session, WT_ERROR, + WT_ERR_MSG(session, WT_ERROR, "file contains multiple file formats (both " "%s and %s), and cannot be salvaged", __wt_page_type_string(ss->page_type), diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c index df6be9955df..6661dde5093 100644 --- a/src/btree/rec_write.c +++ b/src/btree/rec_write.c @@ -2978,7 +2978,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) WT_ERR(__wt_buf_set_printable( session, tkey, bnd->key.data, bnd->key.size)); - WT_VERBOSE_RET(session, reconcile, + WT_VERBOSE_ERR(session, reconcile, "split: starting key " "%.*s", (int)tkey->size, @@ -2987,11 +2987,11 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) case WT_PAGE_COL_FIX: case WT_PAGE_COL_INT: case WT_PAGE_COL_VAR: - WT_VERBOSE_RET(session, reconcile, + WT_VERBOSE_ERR(session, reconcile, "split: starting recno %" PRIu64, bnd->recno); break; - WT_ILLEGAL_VALUE(session); + WT_ILLEGAL_VALUE_ERR(session); } err: __wt_scr_free(&tkey); } diff --git a/src/log/log.c b/src/log/log.c index 23dcd736093..0f9adb9610a 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -25,15 +25,15 @@ __wt_log_put(WT_SESSION_IMPL *session, WT_LOGREC_DESC *recdesc, ...) buf = &session->logrec_buf; va_start(ap, recdesc); - WT_ERR(__log_record_size(session, &size, recdesc, ap)); + ret = __log_record_size(session, &size, recdesc, ap); va_end(ap); + WT_RET(ret); WT_RET(__wt_buf_initsize(session, buf, size)); va_start(ap, recdesc); - WT_ERR(__wt_struct_packv(session, buf->mem, size, recdesc->fmt, ap)); -err: va_end(ap); - + ret = __wt_struct_packv(session, buf->mem, size, recdesc->fmt, ap); + va_end(ap); return (ret); } diff --git a/src/meta/meta_turtle.c b/src/meta/meta_turtle.c index 5092c88e19b..862f7b11ab5 100644 --- a/src/meta/meta_turtle.c +++ b/src/meta/meta_turtle.c @@ -17,11 +17,11 @@ __wt_meta_turtle_init(WT_SESSION_IMPL *session, int *existp) WT_DECL_RET; WT_ITEM *buf; int exist; - const char *metaconf, *path; + const char *metaconf; const char *cfg[] = API_CONF_DEFAULTS(file, meta, NULL); buf = NULL; - metaconf = path = NULL; + metaconf = NULL; *existp = 0; /* Discard any turtle setup file left-over from previous runs. */ @@ -42,11 +42,10 @@ __wt_meta_turtle_init(WT_SESSION_IMPL *session, int *existp) "key_format=S,value_format=S,version=(major=%d,minor=%d)", WT_BTREE_MAJOR_VERSION, WT_BTREE_MINOR_VERSION)); cfg[1] = buf->data; - WT_RET(__wt_config_collapse(session, cfg, &metaconf)); + WT_ERR(__wt_config_collapse(session, cfg, &metaconf)); WT_ERR(__wt_meta_turtle_update(session, WT_METADATA_URI, metaconf)); err: __wt_free(session, metaconf); - __wt_free(session, path); __wt_scr_free(&buf); return (ret); |