diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/btree/bt_cursor.c | 12 | ||||
-rw-r--r-- | src/cursor/cur_file.c | 4 | ||||
-rw-r--r-- | src/cursor/cur_std.c | 5 | ||||
-rw-r--r-- | src/include/extern.h | 4 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 6 |
5 files changed, 15 insertions, 16 deletions
diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index e3fa169e751..704b258a7dd 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -875,10 +875,11 @@ __cursor_equals(WT_CURSOR_BTREE *a, WT_CURSOR_BTREE *b) */ int __wt_btcur_equals( - WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp) + WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp) { WT_CURSOR *a, *b; WT_SESSION_IMPL *session; + int cmp; a = (WT_CURSOR *)a_arg; b = (WT_CURSOR *)b_arg; @@ -893,15 +894,14 @@ __wt_btcur_equals( * The reason for an equals method is because we can avoid doing * a full key comparison in some cases. If both cursors point into the * tree, take the fast path, otherwise fall back to the slower compare - * method; in both cases, return 0 if the cursors are equal, 1 if they + * method; in both cases, return 1 if the cursors are equal, 0 if they * are not. */ if (F_ISSET(a, WT_CURSTD_KEY_INT) && F_ISSET(b, WT_CURSTD_KEY_INT)) - *cmpp = !__cursor_equals(a_arg, b_arg); + *equalp = __cursor_equals(a_arg, b_arg); else { - WT_RET(__wt_btcur_compare(a_arg, b_arg, cmpp)); - if (*cmpp != 0) - *cmpp = 1; + WT_RET(__wt_btcur_compare(a_arg, b_arg, &cmp)); + *equalp = (cmp == 0) ? 1 : 0; } return (0); } diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index 5136ba04243..fd044ff87b6 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -68,7 +68,7 @@ err: API_END_RET(session, ret); * WT_CURSOR->equals method for the btree cursor type. */ static int -__curfile_equals(WT_CURSOR *a, WT_CURSOR *b, int *cmpp) +__curfile_equals(WT_CURSOR *a, WT_CURSOR *b, int *equalp) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; @@ -90,7 +90,7 @@ __curfile_equals(WT_CURSOR *a, WT_CURSOR *b, int *cmpp) WT_CURSOR_CHECKKEY(b); ret = __wt_btcur_equals( - (WT_CURSOR_BTREE *)a, (WT_CURSOR_BTREE *)b, cmpp); + (WT_CURSOR_BTREE *)a, (WT_CURSOR_BTREE *)b, equalp); err: API_END_RET(session, ret); } diff --git a/src/cursor/cur_std.c b/src/cursor/cur_std.c index 0e3f8a7f460..494b54890e5 100644 --- a/src/cursor/cur_std.c +++ b/src/cursor/cur_std.c @@ -506,7 +506,7 @@ __wt_cursor_close(WT_CURSOR *cursor) * WT_CURSOR->equals default implementation. */ int -__wt_cursor_equals(WT_CURSOR *cursor, WT_CURSOR *other, int *equalityp) +__wt_cursor_equals(WT_CURSOR *cursor, WT_CURSOR *other, int *equalp) { WT_DECL_RET; WT_SESSION_IMPL *session; @@ -516,8 +516,7 @@ __wt_cursor_equals(WT_CURSOR *cursor, WT_CURSOR *other, int *equalityp) CURSOR_API_CALL(cursor, session, equals, NULL); WT_ERR(cursor->compare(cursor, other, &cmp)); - - *equalityp = (cmp == 0) ? 0 : 1; + *equalp = (cmp == 0) ? 1 : 0; err: API_END(session, ret); return (ret); diff --git a/src/include/extern.h b/src/include/extern.h index 94146e8d0d5..5555fe832ff 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -96,7 +96,7 @@ extern int __wt_btcur_remove(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_update(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_next_random(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_compare(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp); -extern int __wt_btcur_equals( WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *cmpp); +extern int __wt_btcur_equals( WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp); extern int __wt_btcur_range_truncate(WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop); extern int __wt_btcur_close(WT_CURSOR_BTREE *cbt); extern int __wt_debug_set_verbose(WT_SESSION_IMPL *session, const char *v); @@ -281,7 +281,7 @@ extern int __wt_cursor_get_valuev(WT_CURSOR *cursor, va_list ap); extern void __wt_cursor_set_value(WT_CURSOR *cursor, ...); extern void __wt_cursor_set_valuev(WT_CURSOR *cursor, va_list ap); extern int __wt_cursor_close(WT_CURSOR *cursor); -extern int __wt_cursor_equals(WT_CURSOR *cursor, WT_CURSOR *other, int *equalityp); +extern int __wt_cursor_equals(WT_CURSOR *cursor, WT_CURSOR *other, int *equalp); extern int __wt_cursor_dup_position(WT_CURSOR *to_dup, WT_CURSOR *cursor); extern int __wt_cursor_init(WT_CURSOR *cursor, const char *uri, WT_CURSOR *owner, const char *cfg[], WT_CURSOR **cursorp); extern int __wt_curtable_get_key(WT_CURSOR *cursor, ...); diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 8bd1d301990..84b5a81a1f3 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -295,11 +295,11 @@ struct __wt_cursor { * * @param cursor the cursor handle * @param other another cursor handle - * @param equalityp the status of the comparison: 0 if the cursors - * refer to the same key, otherwise 1. + * @param[out] equalp the status of the comparison: 1 if the cursors + * refer to the same key, otherwise 0. * @errors */ - int __F(equals)(WT_CURSOR *cursor, WT_CURSOR *other, int *equalityp); + int __F(equals)(WT_CURSOR *cursor, WT_CURSOR *other, int *equalp); /*! * Return the next record. |