summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-04-09 11:52:13 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2015-04-25 12:46:08 +1000
commit7253454660c70c8c90451609b7c0932772f4d7eb (patch)
tree165eaa48a430767a4590629d29aca4a23e3ab741
parent87479274cdedc467b070f2d4a3c8c033955406d2 (diff)
downloadmongo-7253454660c70c8c90451609b7c0932772f4d7eb.tar.gz
Remove unnecessary error labels, fixing SERVER-17948 along the way.
Coverity analysis defect 72088: Redundant test: File: /src/third_party/wiredtiger/src/log/log.c Function __log_decompress /src/third_party/wiredtiger/src/log/log.c, line: 363 At condition "ret != 0", the value of "ret" must be equal to 0.
-rw-r--r--src/async/async_worker.c6
-rw-r--r--src/log/log.c16
-rw-r--r--src/txn/txn_recover.c22
3 files changed, 20 insertions, 24 deletions
diff --git a/src/async/async_worker.c b/src/async/async_worker.c
index 543046f7a0c..f956c11b05c 100644
--- a/src/async/async_worker.c
+++ b/src/async/async_worker.c
@@ -105,12 +105,10 @@ retry:
static int
__async_flush_wait(WT_SESSION_IMPL *session, WT_ASYNC *async, uint64_t my_gen)
{
- WT_DECL_RET;
-
while (async->flush_state == WT_ASYNC_FLUSHING &&
async->flush_gen == my_gen)
- WT_ERR(__wt_cond_wait(session, async->flush_cond, 10000));
-err: return (ret);
+ WT_RET(__wt_cond_wait(session, async->flush_cond, 10000));
+ return (0);
}
/*
diff --git a/src/log/log.c b/src/log/log.c
index 5a85bf9628a..4196683d4e4 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -352,7 +352,6 @@ __log_decompress(WT_SESSION_IMPL *session, WT_ITEM *in, WT_ITEM **out)
{
WT_COMPRESSOR *compressor;
WT_CONNECTION_IMPL *conn;
- WT_DECL_RET;
WT_LOG_RECORD *logrec;
size_t result_len, skip;
uint32_t uncompressed_size;
@@ -362,14 +361,14 @@ __log_decompress(WT_SESSION_IMPL *session, WT_ITEM *in, WT_ITEM **out)
skip = WT_LOG_COMPRESS_SKIP;
compressor = conn->log_compressor;
if (compressor == NULL || compressor->decompress == NULL)
- WT_ERR_MSG(session, WT_ERROR,
+ WT_RET_MSG(session, WT_ERROR,
"log_read: Compressed record with "
"no configured compressor");
uncompressed_size = logrec->mem_len;
- WT_ERR(__wt_scr_alloc(session, 0, out));
- WT_ERR(__wt_buf_initsize(session, *out, uncompressed_size));
+ WT_RET(__wt_scr_alloc(session, 0, out));
+ WT_RET(__wt_buf_initsize(session, *out, uncompressed_size));
memcpy((*out)->mem, in->mem, skip);
- WT_ERR(compressor->decompress(compressor, &session->iface,
+ WT_RET(compressor->decompress(compressor, &session->iface,
(uint8_t *)in->mem + skip, in->size - skip,
(uint8_t *)(*out)->mem + skip,
uncompressed_size - skip, &result_len));
@@ -380,9 +379,10 @@ __log_decompress(WT_SESSION_IMPL *session, WT_ITEM *in, WT_ITEM **out)
* here after corruption happens. If we're salvaging the file,
* it's OK, otherwise it's really, really bad.
*/
- if (ret != 0 || result_len != uncompressed_size - WT_LOG_COMPRESS_SKIP)
- WT_ERR(WT_ERROR);
-err: return (ret);
+ if (result_len != uncompressed_size - WT_LOG_COMPRESS_SKIP)
+ return (WT_ERROR);
+
+ return (0);
}
/*
diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c
index 04b9579be9c..f6cd384417f 100644
--- a/src/txn/txn_recover.c
+++ b/src/txn/txn_recover.c
@@ -376,32 +376,30 @@ __recovery_free(WT_RECOVERY *r)
static int
__recovery_file_scan(WT_RECOVERY *r)
{
- WT_DECL_RET;
WT_CURSOR *c;
- const char *uri, *config;
+ WT_DECL_RET;
int cmp;
+ const char *uri, *config;
/* Scan through all files in the metadata. */
c = r->files[0].c;
c->set_key(c, "file:");
if ((ret = c->search_near(c, &cmp)) != 0) {
/* Is the metadata empty? */
- if (ret == WT_NOTFOUND)
- ret = 0;
- goto err;
+ WT_RET_NOTFOUND_OK(ret);
+ return (0);
}
if (cmp < 0)
- WT_ERR_NOTFOUND_OK(c->next(c));
+ WT_RET_NOTFOUND_OK(c->next(c));
for (; ret == 0; ret = c->next(c)) {
- WT_ERR(c->get_key(c, &uri));
+ WT_RET(c->get_key(c, &uri));
if (!WT_PREFIX_MATCH(uri, "file:"))
break;
- WT_ERR(c->get_value(c, &config));
- WT_ERR(__recovery_setup_file(r, uri, config));
+ WT_RET(c->get_value(c, &config));
+ WT_RET(__recovery_setup_file(r, uri, config));
}
- WT_ERR_NOTFOUND_OK(ret);
-
-err: return (ret);
+ WT_RET_NOTFOUND_OK(ret);
+ return (0);
}
/*