summaryrefslogtreecommitdiff
path: root/src/btree/bt_rebalance.c
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2017-08-20 21:51:33 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2017-08-21 11:51:33 +1000
commit3cf393963c950a5f9d8207194dc08ba1016f4303 (patch)
treea78510239335fbc005f548ee3955fb26457914d3 /src/btree/bt_rebalance.c
parentb055251678e6b4fcc74a1f651432aadbfeecc0e4 (diff)
downloadmongo-3cf393963c950a5f9d8207194dc08ba1016f4303.tar.gz
WT-3522 lint (#3598)
* CID 1379736 (#1 of 1): Unchecked return value (CHECKED_RETURN) check_return: Calling __wt_spin_init without checking return value * By decreasing WT_MAX_MODIFY_UPDATE from 100 to 10, we increased the likelihood of exceeding it when threads race, and we're prefer not to allocate memory in a return path. Add a few additional slots to the array we use to build up a list of modify records to apply. * Split __wt_strndup() into two parts: __wt_strndup() which checks for NULL pointers and nul-terminates the copy, and __wt_memdup() which does a byte string copy and nothing more. Switch the WiredTiger calls that are doing byte copies (generally disk images or address chunks), to call __wt_memdup(). * Use ENOTSUP for unsupported operations, don't repeat the method name in the error message, the error functions output it already. * MSVC Doesn't provide __func__, it has __FUNCTION__. There was a fix in the utility code, move that fix into the WiredTiger include files so it's generally available. * Switch WiredTiger diagnostics that use __FILE__ to use __func__, it gives us a better indication of the error location if we don't have a file version (and takes up less text space, if anyone cares). * clang static-analyzer complains we call __wt_config_gets() and trust it won't modify the value WT_CONFIG_ITEM if it returns WT_NOTFOUND. * Add minor text to error messages to make it apparent which error occurred when WiredTiger is starting up.
Diffstat (limited to 'src/btree/bt_rebalance.c')
-rw-r--r--src/btree/bt_rebalance.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/btree/bt_rebalance.c b/src/btree/bt_rebalance.c
index 47c7888af35..a616ab7fc42 100644
--- a/src/btree/bt_rebalance.c
+++ b/src/btree/bt_rebalance.c
@@ -83,7 +83,7 @@ __rebalance_leaf_append(WT_SESSION_IMPL *session,
WT_RET(__wt_calloc_one(session, &copy_addr));
copy->addr = copy_addr;
- WT_RET(__wt_strndup(session, addr, addr_len, &copy_addr->addr));
+ WT_RET(__wt_memdup(session, addr, addr_len, &copy_addr->addr));
copy_addr->size = (uint8_t)addr_len;
copy_addr->type = (uint8_t)addr_type;
@@ -110,7 +110,7 @@ __rebalance_fl_append(WT_SESSION_IMPL *session,
session, &rs->fl_allocated, rs->fl_next + 1, &rs->fl));
copy = &rs->fl[rs->fl_next++];
- WT_RET(__wt_strndup(session, addr, addr_len, &copy->addr));
+ WT_RET(__wt_memdup(session, addr, addr_len, &copy->addr));
copy->size = (uint8_t)addr_len;
copy->type = 0;