diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-06-01 22:52:34 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-06-01 22:52:34 +1000 |
commit | 177a0a0f073775af95391ee915f7232fb875fa41 (patch) | |
tree | 2723b36338c56f73ae12392c144525cd38c7f803 | |
parent | 0b0862ff97e47b1a4f40671f33ec20be11b56735 (diff) | |
download | mongo-177a0a0f073775af95391ee915f7232fb875fa41.tar.gz |
Simplify the regular expression in s_style for non-GNU grep.
Fix a couple more cases where we could return in bad places.
-rw-r--r-- | dist/s_style | 2 | ||||
-rw-r--r-- | src/btree/bt_slvg.c | 2 | ||||
-rw-r--r-- | src/btree/rec_write.c | 2 | ||||
-rw-r--r-- | src/include/error.h | 11 |
4 files changed, 12 insertions, 5 deletions
diff --git a/dist/s_style b/dist/s_style index bf2929589fa..15447bbec92 100644 --- a/dist/s_style +++ b/dist/s_style @@ -16,7 +16,7 @@ for f in `find examples ext src test -name '*.[ci]'`; do -e 's/\n/ /g' \ -e p \ -e '{s/.*//;x;}' | - egrep 'WT_ERR\(.*WT_RET.*err:|WT_ERR\(.*WT_RET_MSG.*err:|WT_ERR\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR\(.*WT_VERBOSE_RET\(.*err:|WT_ERR\(.*WT_VERBOSE_RETVAL\(.*err:|WT_ERR_MSG\(.*WT_RET.*err:|WT_ERR_MSG\(.*WT_RET_MSG.*err:|WT_ERR_MSG\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR_MSG\(.*WT_VERBOSE_RET\(.*err:|WT_ERR_MSG\(.*WT_VERBOSE_RETVAL\(.*err:|WT_ERR_TEST\(.*WT_RET.*err:|WT_ERR_TEST\(.*WT_RET_MSG.*err:|WT_ERR_TEST\(.*WT_ILLEGAL_VALUE\(.*err:|WT_ERR_TEST\(.*WT_VERBOSE_RET\(.*err:|WT_ERR_TEST\(.*WT_VERBOSE_RETVAL\(.*err:'| + egrep '(WT_ERR|WT_ERR_MSG|WT_ERR_TEST|WT_ILLEGAL_VALUE_ERR)\(.*(WT_ASSERT_RET|WT_ILLEGAL_VALUE|WT_RET|WT_RET_MSG|WT_RET_TEST|WT_VERBOSE_RET|WT_VERBOSE_RETVAL)\(.*err:' | sed 's/:.*//' > $t test -s $t && { echo "$f: function with return after a jump to an error label" diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index 897a1826922..f7559c9d200 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -1808,7 +1808,7 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, * least one cell on the page we want. This is a change from previous * behavior, so I'm asserting it. */ - WT_ASSERT_RET(session, skip_start + skip_stop < page->entries); + WT_ASSERT_ERR(session, skip_start + skip_stop < page->entries); /* * Take a copy of this page's first key to define the start of diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c index 9483403a873..22539e1ff73 100644 --- a/src/btree/rec_write.c +++ b/src/btree/rec_write.c @@ -938,7 +938,7 @@ __rec_split_fixup(WT_SESSION_IMPL *session) * Fix up our caller's information. */ len = WT_PTRDIFF32(r->first_free, bnd->start); - WT_ASSERT_RET( + WT_ASSERT_ERR( session, len < r->split_size - WT_PAGE_HEADER_BYTE_SIZE(btree)); dsk = r->dsk.mem; diff --git a/src/include/error.h b/src/include/error.h index 9c2a9ddfef7..4d8f18ae74e 100644 --- a/src/include/error.h +++ b/src/include/error.h @@ -58,14 +58,21 @@ } while (0) /* - * WT_ASSERT, WT_ASSERT_RET -- + * WT_ASSERT, WT_ASSERT_ERR, WT_ASSERT_RET -- * Assert an expression, abort in diagnostic mode, otherwise, optionally - * return an error. + * return an error. */ #define WT_ASSERT(session, exp) do { \ if (!(exp)) \ __wt_assert(session, 0, __FILE__, __LINE__, "%s", #exp);\ } while (0) +#define WT_ASSERT_ERR(session, exp) do { \ + if (!(exp)) { \ + __wt_assert( \ + session, WT_ERROR, __FILE__, __LINE__, "%s", #exp); \ + WT_ERR(WT_ERROR); \ + } \ +} while (0) #define WT_ASSERT_RET(session, exp) do { \ if (!(exp)) { \ __wt_assert( \ |