diff options
53 files changed, 265 insertions, 297 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index f900032127d..e8aaea5ed1e 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -409,6 +409,5 @@ flags = { # Structure flag declarations ################################################### 'conn' : [ 'SERVER_RUN' ], - 'buf' : [ 'BUF_INUSE' ], 'session' : [ 'SESSION_INTERNAL', 'SESSION_SALVAGE_QUIET_ERR' ], } diff --git a/src/block/block_addr.c b/src/block/block_addr.c index 5c8d50cf3b1..f292c8afca0 100644 --- a/src/block/block_addr.c +++ b/src/block/block_addr.c @@ -78,7 +78,7 @@ __wt_block_addr_valid(WT_SESSION_IMPL *session, */ int __wt_block_addr_string(WT_SESSION_IMPL *session, - WT_BLOCK *block, WT_BUF *buf, const uint8_t *addr, uint32_t addr_size) + WT_BLOCK *block, WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size) { off_t offset; uint32_t cksum, size; diff --git a/src/block/block_alloc.c b/src/block/block_alloc.c index 2ce2d2454da..d904265f412 100644 --- a/src/block/block_alloc.c +++ b/src/block/block_alloc.c @@ -343,7 +343,7 @@ __wt_block_freelist_open(WT_SESSION_IMPL *session, WT_BLOCK *block) int __wt_block_freelist_read(WT_SESSION_IMPL *session, WT_BLOCK *block) { - WT_BUF *tmp; + WT_ITEM *tmp; off_t offset; uint32_t size; uint8_t *p; @@ -419,7 +419,7 @@ __wt_block_freelist_close(WT_SESSION_IMPL *session, WT_BLOCK *block) int __wt_block_freelist_write(WT_SESSION_IMPL *session, WT_BLOCK *block) { - WT_BUF *tmp; + WT_ITEM *tmp; WT_FREE_ENTRY *fe; WT_PAGE_HEADER *dsk; off_t offset; diff --git a/src/block/block_mgr.c b/src/block/block_mgr.c index 2d34c8efeac..3391ce27210 100644 --- a/src/block/block_mgr.c +++ b/src/block/block_mgr.c @@ -39,7 +39,7 @@ __wt_bm_addr_stderr( WT_SESSION_IMPL *session, const uint8_t *addr, uint32_t addr_size) { WT_BLOCK *block; - WT_BUF *buf; + WT_ITEM *buf; int ret; if ((block = session->btree->block) == NULL) @@ -60,7 +60,7 @@ __wt_bm_addr_stderr( */ int __wt_bm_addr_string(WT_SESSION_IMPL *session, - WT_BUF *buf, const uint8_t *addr, uint32_t addr_size) + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size) { WT_BLOCK *block; @@ -143,7 +143,7 @@ __wt_bm_free(WT_SESSION_IMPL *session, const uint8_t *addr, uint32_t addr_size) */ int __wt_bm_read(WT_SESSION_IMPL *session, - WT_BUF *buf, const uint8_t *addr, uint32_t addr_size) + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size) { WT_BLOCK *block; @@ -189,7 +189,7 @@ __wt_bm_write_size(WT_SESSION_IMPL *session, uint32_t *sizep) */ int __wt_bm_write( - WT_SESSION_IMPL *session, WT_BUF *buf, uint8_t *addr, uint32_t *addr_size) + WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, uint32_t *addr_size) { WT_BLOCK *block; @@ -235,7 +235,7 @@ __wt_bm_salvage_start(WT_SESSION_IMPL *session) * Return the next block from the file. */ int -__wt_bm_salvage_next(WT_SESSION_IMPL *session, WT_BUF *buf, +__wt_bm_salvage_next(WT_SESSION_IMPL *session, WT_ITEM *buf, uint8_t *addr, uint32_t *addr_sizep, uint64_t *write_genp, int *eofp) { WT_BLOCK *block; diff --git a/src/block/block_read.c b/src/block/block_read.c index f7ad79afb38..c3d092c68b3 100644 --- a/src/block/block_read.c +++ b/src/block/block_read.c @@ -13,9 +13,9 @@ */ int __wt_block_read_buf(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, const uint8_t *addr, uint32_t addr_size) + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size) { - WT_BUF *tmp; + WT_ITEM *tmp; off_t offset; uint32_t size, cksum; int ret; @@ -48,10 +48,10 @@ err: __wt_scr_free(&tmp); */ int __wt_block_read(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, off_t offset, uint32_t size, uint32_t cksum) + WT_ITEM *buf, off_t offset, uint32_t size, uint32_t cksum) { WT_BLOCK_HEADER *blk; - WT_BUF *tmp; + WT_ITEM *tmp; WT_PAGE_HEADER *dsk; size_t result_len; uint32_t page_cksum; diff --git a/src/block/block_slvg.c b/src/block/block_slvg.c index 44a52a1f0fc..cbbee94527c 100644 --- a/src/block/block_slvg.c +++ b/src/block/block_slvg.c @@ -69,7 +69,7 @@ __wt_block_salvage_end(WT_SESSION_IMPL *session, WT_BLOCK *block, int success) */ int __wt_block_salvage_next( - WT_SESSION_IMPL *session, WT_BLOCK *block, WT_BUF *buf, + WT_SESSION_IMPL *session, WT_BLOCK *block, WT_ITEM *buf, uint8_t *addr, uint32_t *addr_sizep, uint64_t *write_genp, int *eofp) { WT_BLOCK_HEADER *blk; diff --git a/src/block/block_write.c b/src/block/block_write.c index 95e785cbbd7..dc123ae51d9 100644 --- a/src/block/block_write.c +++ b/src/block/block_write.c @@ -41,7 +41,7 @@ __wt_block_write_size( */ int __wt_block_write_buf(WT_SESSION_IMPL *session, - WT_BLOCK *block, WT_BUF *buf, uint8_t *addr, uint32_t *addr_size) + WT_BLOCK *block, WT_ITEM *buf, uint8_t *addr, uint32_t *addr_size) { off_t offset; uint32_t size, cksum; @@ -65,11 +65,11 @@ __wt_block_write_buf(WT_SESSION_IMPL *session, */ int __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, off_t *offsetp, uint32_t *sizep, uint32_t *cksump) + WT_ITEM *buf, off_t *offsetp, uint32_t *sizep, uint32_t *cksump) { WT_BLOCK_HEADER *blk; WT_PAGE_HEADER *dsk; - WT_BUF *tmp; + WT_ITEM *tmp; off_t offset; uint32_t align_size, size; int compression_failed, ret; @@ -89,7 +89,7 @@ __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, dsk->size = buf->size; /* - * We're passed a table's page image: WT_BUF->{mem,size} are the image + * We're passed a table's page image: WT_ITEM->{mem,size} are the image * and byte count. * * Diagnostics: verify the disk page: this violates layering, but it's diff --git a/src/btree/bt_bulk.c b/src/btree/bt_bulk.c index c2b6486fc70..4230f79fafe 100644 --- a/src/btree/bt_bulk.c +++ b/src/btree/bt_bulk.c @@ -88,8 +88,7 @@ __wt_bulk_insert(WT_CURSOR_BULK *cbulk) */ if (cbulk->rle != 0) { WT_RET(WT_BTREE_CMP(session, session->btree, - (WT_ITEM *)&cursor->key, - (WT_ITEM *)&cbulk->cmp, cmp)); + &cursor->key, &cbulk->cmp, cmp)); if (cmp <= 0) return (__bulk_row_keycmp_err(cbulk)); } @@ -132,7 +131,7 @@ __wt_bulk_end(WT_CURSOR_BULK *cbulk) static int __bulk_row_keycmp_err(WT_CURSOR_BULK *cbulk) { - WT_BUF a, b; + WT_ITEM a, b; WT_CURSOR *cursor; WT_SESSION_IMPL *session; diff --git a/src/btree/bt_cell.c b/src/btree/bt_cell.c index 864068f7c49..e7b6fdd8802 100644 --- a/src/btree/bt_cell.c +++ b/src/btree/bt_cell.c @@ -12,7 +12,7 @@ * Copy an on-page cell into a return buffer, processing as needed. */ int -__wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, WT_BUF *retb) +__wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, WT_ITEM *retb) { WT_CELL_UNPACK *unpack, _unpack; @@ -28,7 +28,7 @@ __wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, WT_BUF *retb) */ int __wt_cell_unpack_copy( - WT_SESSION_IMPL *session, WT_CELL_UNPACK *unpack, WT_BUF *retb) + WT_SESSION_IMPL *session, WT_CELL_UNPACK *unpack, WT_ITEM *retb) { WT_BTREE *btree; void *huffman; diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c index 6cfd8e7dc58..1a4b257f74e 100644 --- a/src/btree/bt_curnext.c +++ b/src/btree/bt_curnext.c @@ -14,7 +14,7 @@ static inline int __cursor_fix_append_next(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *val; + WT_ITEM *val; val = &cbt->iface.value; @@ -44,8 +44,8 @@ static inline int __cursor_fix_next(WT_CURSOR_BTREE *cbt, int newpage) { WT_BTREE *btree; - WT_BUF *val; WT_INSERT *ins; + WT_ITEM *val; WT_SESSION_IMPL *session; uint64_t *recnop; @@ -94,7 +94,7 @@ new_page: *recnop = cbt->recno; static inline int __cursor_var_append_next(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *val; + WT_ITEM *val; val = &cbt->iface.value; @@ -124,11 +124,11 @@ new_page: cbt->iface.recno = WT_INSERT_RECNO(cbt->ins); static inline int __cursor_var_next(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *val; WT_CELL *cell; WT_CELL_UNPACK unpack; WT_COL *cip; WT_INSERT *ins; + WT_ITEM *val; WT_SESSION_IMPL *session; uint64_t *recnop; @@ -205,7 +205,7 @@ new_page: *recnop = cbt->recno; static inline int __cursor_row_next(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *key, *val; + WT_ITEM *key, *val; WT_ROW *rip; WT_UPDATE *upd; diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c index 907f005cf31..598d32eb40d 100644 --- a/src/btree/bt_curprev.c +++ b/src/btree/bt_curprev.c @@ -114,7 +114,7 @@ __cursor_skip_prev(WT_CURSOR_BTREE *cbt) static inline int __cursor_fix_append_prev(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *val; + WT_ITEM *val; val = &cbt->iface.value; @@ -149,8 +149,8 @@ static inline int __cursor_fix_prev(WT_CURSOR_BTREE *cbt, int newpage) { WT_BTREE *btree; - WT_BUF *val; WT_INSERT *ins; + WT_ITEM *val; WT_SESSION_IMPL *session; uint64_t *recnop; @@ -199,7 +199,7 @@ new_page: *recnop = cbt->recno; static inline int __cursor_var_append_prev(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *val; + WT_ITEM *val; val = &cbt->iface.value; @@ -230,11 +230,11 @@ new_page: if (cbt->ins == NULL) static inline int __cursor_var_prev(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *val; WT_CELL *cell; WT_CELL_UNPACK unpack; WT_COL *cip; WT_INSERT *ins; + WT_ITEM *val; WT_SESSION_IMPL *session; uint64_t *recnop; @@ -312,8 +312,8 @@ new_page: *recnop = cbt->recno; static inline int __cursor_row_prev(WT_CURSOR_BTREE *cbt, int newpage) { - WT_BUF *key, *val; WT_INSERT *ins; + WT_ITEM *key, *val; WT_ROW *rip; WT_SESSION_IMPL *session; WT_UPDATE *upd; diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index 77e56369a4f..d878204808b 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -12,7 +12,7 @@ * Return if an inserted item is too large. */ static inline int -__cursor_size_chk(WT_SESSION_IMPL *session, WT_BUF *kv) +__cursor_size_chk(WT_SESSION_IMPL *session, WT_ITEM *kv) { WT_BTREE *btree; @@ -103,8 +103,8 @@ int __wt_btcur_search(WT_CURSOR_BTREE *cbt) { WT_BTREE *btree; - WT_BUF *val; WT_CURSOR *cursor; + WT_ITEM *val; WT_SESSION_IMPL *session; int ret; @@ -149,7 +149,7 @@ int __wt_btcur_search_near(WT_CURSOR_BTREE *cbt, int *exact) { WT_BTREE *btree; - WT_BUF *val; + WT_ITEM *val; WT_CURSOR *cursor; WT_SESSION_IMPL *session; int ret; diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index 8a60b1a3b61..db04f493fdc 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -19,9 +19,9 @@ typedef struct { * do its own message handling because its output isn't line-oriented. */ FILE *fp; /* Output file stream */ - WT_BUF *msg; /* Buffered message */ + WT_ITEM *msg; /* Buffered message */ - WT_BUF *tmp; /* Temporary space */ + WT_ITEM *tmp; /* Temporary space */ } WT_DBG; /* Diagnostic output separator. */ @@ -99,7 +99,7 @@ static void __dmsg_wrapup(WT_DBG *ds) { WT_SESSION_IMPL *session; - WT_BUF *msg; + WT_ITEM *msg; session = ds->session; msg = ds->msg; @@ -129,7 +129,7 @@ static void __dmsg(WT_DBG *ds, const char *fmt, ...) { va_list ap; - WT_BUF *msg; + WT_ITEM *msg; WT_SESSION_IMPL *session; size_t len, space; char *p; @@ -188,7 +188,7 @@ int __wt_debug_addr( WT_SESSION_IMPL *session, uint32_t addr, uint32_t size, const char *ofile) { - WT_BUF *buf; + WT_ITEM *buf; int ret; buf = NULL; @@ -824,7 +824,7 @@ __debug_ref(WT_DBG *ds, WT_REF *ref, WT_PAGE *page) static int __debug_cell(WT_DBG *ds, WT_PAGE_HEADER *dsk, WT_CELL_UNPACK *unpack) { - WT_BUF *buf; + WT_ITEM *buf; WT_SESSION_IMPL *session; int ret; @@ -876,7 +876,7 @@ __debug_cell(WT_DBG *ds, WT_PAGE_HEADER *dsk, WT_CELL_UNPACK *unpack) static int __debug_cell_data(WT_DBG *ds, const char *tag, WT_CELL_UNPACK *unpack) { - WT_BUF *buf; + WT_ITEM *buf; WT_SESSION_IMPL *session; int ret; diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index ca3c8319e94..5a652932095 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -282,7 +282,7 @@ __btree_conf(WT_SESSION_IMPL *session, const char *config, uint32_t flags) static int __btree_tree_init(WT_SESSION_IMPL *session) { - WT_BUF *addr; + WT_ITEM *addr; int ret; ret = 0; @@ -312,10 +312,10 @@ err: __wt_scr_free(&addr); * Read in a tree from disk. */ int -__wt_btree_root_init(WT_SESSION_IMPL *session, WT_BUF *addr) +__wt_btree_root_init(WT_SESSION_IMPL *session, WT_ITEM *addr) { WT_BTREE *btree; - WT_BUF tmp; + WT_ITEM tmp; WT_PAGE *page; int ret; diff --git a/src/btree/bt_misc.c b/src/btree/bt_misc.c index a8232363366..9ed42431751 100644 --- a/src/btree/bt_misc.c +++ b/src/btree/bt_misc.c @@ -73,7 +73,7 @@ __wt_cell_type_string(uint8_t type) * nul-terminated representation of that address. */ const char * -__wt_page_addr_string(WT_SESSION_IMPL *session, WT_BUF *buf, WT_PAGE *page) +__wt_page_addr_string(WT_SESSION_IMPL *session, WT_ITEM *buf, WT_PAGE *page) { uint32_t size; const uint8_t *addr; @@ -96,7 +96,7 @@ __wt_page_addr_string(WT_SESSION_IMPL *session, WT_BUF *buf, WT_PAGE *page) */ const char * __wt_addr_string( - WT_SESSION_IMPL *session, WT_BUF *buf, const uint8_t *addr, uint32_t size) + WT_SESSION_IMPL *session, WT_ITEM *buf, const uint8_t *addr, uint32_t size) { if (addr == NULL) { buf->data = WT_NOADDR; diff --git a/src/btree/bt_ovfl.c b/src/btree/bt_ovfl.c index 8cec2046c10..4d90646bdbd 100644 --- a/src/btree/bt_ovfl.c +++ b/src/btree/bt_ovfl.c @@ -13,7 +13,7 @@ */ int __wt_ovfl_in( - WT_SESSION_IMPL *session, WT_BUF *store, const uint8_t *addr, uint32_t len) + WT_SESSION_IMPL *session, WT_ITEM *store, const uint8_t *addr, uint32_t len) { WT_BTREE *btree; diff --git a/src/btree/bt_page.c b/src/btree/bt_page.c index 7fb14714ec9..51ef242e34a 100644 --- a/src/btree/bt_page.c +++ b/src/btree/bt_page.c @@ -288,7 +288,7 @@ static int __inmem_row_int(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_BTREE *btree; - WT_BUF *current, *last, *tmp; + WT_ITEM *current, *last, *tmp; WT_CELL *cell; WT_CELL_UNPACK *unpack, _unpack; WT_PAGE_HEADER *dsk; diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index 87c7853a200..6e9691462ba 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -14,7 +14,7 @@ int __wt_cache_read(WT_SESSION_IMPL *session, WT_PAGE *parent, WT_REF *ref) { - WT_BUF tmp; + WT_ITEM tmp; WT_PAGE *page; uint32_t size; const uint8_t *addr; diff --git a/src/btree/bt_root.c b/src/btree/bt_root.c index 9cd4c7f6efa..2a4fa94bd0e 100644 --- a/src/btree/bt_root.c +++ b/src/btree/bt_root.c @@ -22,7 +22,7 @@ static int __btree_set_turtle(WT_SESSION_IMPL *, char *); * Get the file's root address. */ int -__wt_btree_get_root(WT_SESSION_IMPL *session, WT_BUF *addr) +__wt_btree_get_root(WT_SESSION_IMPL *session, WT_ITEM *addr) { WT_BTREE *btree; uint32_t size; @@ -77,7 +77,7 @@ err: if (ret != 0) int __wt_btree_free_root(WT_SESSION_IMPL *session) { - WT_BUF *addr, *as; + WT_ITEM *addr, *as; WT_BTREE *btree; int ret; @@ -108,7 +108,7 @@ int __wt_btree_set_root(WT_SESSION_IMPL *session, uint8_t *addr, uint32_t size) { WT_BTREE *btree; - WT_BUF *v; + WT_ITEM *v; int ret; btree = session->btree; @@ -126,7 +126,7 @@ __wt_btree_set_root(WT_SESSION_IMPL *session, uint8_t *addr, uint32_t size) btree->filename, __wt_addr_string(session, v, addr, size)); /* - * We're not using the WT_BUF as a buffer going forward, but fill + * We're not using the WT_ITEM as a buffer going forward, but fill * in the values anyway, just for safety. */ if (addr == NULL) { @@ -223,7 +223,7 @@ err: if (fp != NULL) static int __btree_set_turtle(WT_SESSION_IMPL *session, char *v) { - WT_BUF *buf; + WT_ITEM *buf; FILE *fp; size_t len; int ret; @@ -270,7 +270,7 @@ __btree_get_root( WT_SESSION_IMPL *session, const char **vp, int *majorp, int *minorp) { WT_BTREE *btree; - WT_BUF *key; + WT_ITEM *key; int ret; const char *version; @@ -306,7 +306,7 @@ static int __btree_set_root(WT_SESSION_IMPL *session, char *v) { WT_BTREE *btree; - WT_BUF *key; + WT_ITEM *key; int ret; btree = session->btree; diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c index b874bea1106..d10b8a7a18d 100644 --- a/src/btree/bt_slvg.c +++ b/src/btree/bt_slvg.c @@ -31,8 +31,8 @@ struct __wt_stuff { /* If need to free blocks backing merged page ranges. */ int merge_free; - WT_BUF *tmp1; /* Verbose print buffer */ - WT_BUF *tmp2; /* Verbose print buffer */ + WT_ITEM *tmp1; /* Verbose print buffer */ + WT_ITEM *tmp2; /* Verbose print buffer */ uint64_t fcnt; /* Progress counter */ }; @@ -59,10 +59,10 @@ struct __wt_track { struct { #undef row_start #define row_start u.row._row_start - WT_BUF _row_start; /* Row-store start range */ + WT_ITEM _row_start; /* Row-store start range */ #undef row_stop #define row_stop u.row._row_stop - WT_BUF _row_stop; /* Row-store stop range */ + WT_ITEM _row_stop; /* Row-store stop range */ } row; struct { @@ -317,7 +317,7 @@ err: if (started) static int __slvg_read(WT_SESSION_IMPL *session, WT_STUFF *ss) { - WT_BUF *as, *buf; + WT_ITEM *as, *buf; WT_PAGE_HEADER *dsk; uint64_t gen; uint32_t addrbuf_size; @@ -1275,8 +1275,8 @@ __slvg_row_range(WT_SESSION_IMPL *session, WT_STUFF *ss) * subsequent pages can overlap our page. */ WT_RET(WT_BTREE_CMP(session, btree, - (WT_ITEM *)&ss->pages[j]->row_start, - (WT_ITEM *)&ss->pages[i]->row_stop, cmp)); + &ss->pages[j]->row_start, + &ss->pages[i]->row_stop, cmp)); if (cmp > 0) break; @@ -1346,15 +1346,11 @@ __slvg_row_range_overlap( * Finally, there's one additional complicating factor -- final ranges * are assigned based on the page's LSN. */ -#define A_TRK_START ((WT_ITEM *)A_TRK_START_BUF) -#define A_TRK_START_BUF (&a_trk->row_start) -#define A_TRK_STOP ((WT_ITEM *)A_TRK_STOP_BUF) -#define A_TRK_STOP_BUF (&a_trk->row_stop) -#define B_TRK_START_BUF (&b_trk->row_start) -#define B_TRK_START ((WT_ITEM *)B_TRK_START_BUF) -#define B_TRK_STOP_BUF (&b_trk->row_stop) -#define B_TRK_STOP ((WT_ITEM *)B_TRK_STOP_BUF) -#define SLOT_START(i) ((WT_ITEM *)&ss->pages[i]->row_start) +#define A_TRK_START (&a_trk->row_start) +#define A_TRK_STOP (&a_trk->row_stop) +#define B_TRK_START (&b_trk->row_start) +#define B_TRK_STOP (&b_trk->row_stop) +#define SLOT_START(i) (&ss->pages[i]->row_start) #define __slvg_key_copy(session, dst, src) \ __wt_buf_set(session, dst, (src)->data, (src)->size) @@ -1404,8 +1400,7 @@ __slvg_row_range_overlap( * Case #6: a_trk is a superset of b_trk, but b_trk is more * desirable: keep both but delete b_trk's key range from a_trk. */ - WT_RET( - __slvg_key_copy(session, A_TRK_STOP_BUF, B_TRK_START_BUF)); + WT_RET(__slvg_key_copy(session, A_TRK_STOP, B_TRK_START)); F_SET(a_trk, WT_TRACK_CHECK_STOP | WT_TRACK_MERGE); goto merge; } @@ -1427,7 +1422,7 @@ __slvg_row_range_overlap( * key range from a_trk; */ WT_RET(__slvg_key_copy( - session, A_TRK_STOP_BUF, B_TRK_START_BUF)); + session, A_TRK_STOP, B_TRK_START)); F_SET(a_trk, WT_TRACK_CHECK_STOP | WT_TRACK_MERGE); } goto merge; @@ -1475,7 +1470,7 @@ delete: WT_RET(__slvg_trk_free(session, * chunk (that's b_trk), and re-sort the WT_TRACK array as necessary to * move our new entry into the right sorted location. */ - WT_RET(__slvg_key_copy(session, &new->row_stop, A_TRK_STOP_BUF)); + WT_RET(__slvg_key_copy(session, &new->row_stop, A_TRK_STOP)); WT_RET( __slvg_row_trk_update_start(session, B_TRK_STOP, a_slot + 1, ss)); @@ -1491,7 +1486,7 @@ delete: WT_RET(__slvg_trk_free(session, * the initial key space in the page, that is, everything up to the * starting key of the middle chunk (that's b_trk). */ - WT_RET(__slvg_key_copy(session, A_TRK_STOP_BUF, B_TRK_START_BUF)); + WT_RET(__slvg_key_copy(session, A_TRK_STOP, B_TRK_START)); F_SET(a_trk, WT_TRACK_CHECK_STOP | WT_TRACK_MERGE); merge: WT_VERBOSE(session, salvage, @@ -1512,9 +1507,8 @@ __slvg_row_trk_update_start( WT_SESSION_IMPL *session, WT_ITEM *stop, uint32_t slot, WT_STUFF *ss) { WT_BTREE *btree; - WT_BUF *key, *dsk; WT_IKEY *ikey; - WT_ITEM *item, _item; + WT_ITEM *dsk, *key, *item, _item; WT_PAGE *page; WT_ROW *rip; WT_TRACK *trk; @@ -1565,7 +1559,7 @@ __slvg_row_trk_update_start( item = &_item; } else { WT_ERR(__wt_row_key(session, page, rip, key)); - item = (WT_ITEM *)key; + item = key; } WT_ERR(WT_BTREE_CMP(session, btree, item, stop, cmp)); if (cmp > 0) { @@ -1593,7 +1587,7 @@ __slvg_row_trk_update_start( if (ss->pages[i] == NULL) continue; WT_ERR(WT_BTREE_CMP(session, btree, - SLOT_START(i), (WT_ITEM *)&trk->row_stop, cmp)); + SLOT_START(i), &trk->row_stop, cmp)); if (cmp > 0) break; } @@ -1690,9 +1684,8 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, WT_TRACK *trk, WT_PAGE *parent, WT_REF *ref, WT_STUFF *ss) { WT_BTREE *btree; - WT_BUF *key; WT_IKEY *ikey; - WT_ITEM *item, _item; + WT_ITEM *item, _item, *key; WT_PAGE *page; WT_ROW *rip; WT_SALVAGE_COOKIE *cookie, _cookie; @@ -1738,14 +1731,14 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, item = &_item; } else { WT_ERR(__wt_row_key(session, page, rip, key)); - item = (WT_ITEM *)key; + item = key; } /* * >= is correct: see the comment above. */ WT_ERR(WT_BTREE_CMP(session, btree, - item, (WT_ITEM *)&trk->row_start, cmp)); + item, &trk->row_start, cmp)); if (cmp >= 0) break; if (WT_VERBOSE_ISSET(session, salvage)) { @@ -1769,14 +1762,14 @@ __slvg_row_build_leaf(WT_SESSION_IMPL *session, item = &_item; } else { WT_ERR(__wt_row_key(session, page, rip, key)); - item = (WT_ITEM *)key; + item = key; } /* * < is correct: see the comment above. */ WT_ERR(WT_BTREE_CMP(session, btree, - item, (WT_ITEM *)&trk->row_stop, cmp)); + item, &trk->row_stop, cmp)); if (cmp < 0) break; if (WT_VERBOSE_ISSET(session, salvage)) { @@ -2106,8 +2099,7 @@ __slvg_trk_compare_key(const void *a, const void *b) case WT_PAGE_ROW_LEAF: btree = a_trk->ss->btree; (void)WT_BTREE_CMP(a_trk->ss->session, btree, - (WT_ITEM *)&a_trk->row_start, - (WT_ITEM *)&b_trk->row_start, cmp); + &a_trk->row_start, &b_trk->row_start, cmp); if (cmp != 0) return (cmp); break; diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index 2252cb4100d..0d78f9d0bbf 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -14,15 +14,15 @@ typedef struct { uint64_t record_total; /* Total record count */ - WT_BUF *max_key; /* Largest key */ - WT_BUF *max_addr; /* Largest key page */ + WT_ITEM *max_key; /* Largest key */ + WT_ITEM *max_addr; /* Largest key page */ uint64_t fcnt; /* Progress counter */ int dumpfile; /* Dump file stream */ - WT_BUF *tmp1; /* Temporary buffer */ - WT_BUF *tmp2; /* Temporary buffer */ + WT_ITEM *tmp1; /* Temporary buffer */ + WT_ITEM *tmp2; /* Temporary buffer */ } WT_VSTUFF; static int __verify_int(WT_SESSION_IMPL *, int); @@ -143,10 +143,10 @@ static int __verify_tree(WT_SESSION_IMPL *session, WT_PAGE *page, uint64_t parent_recno, WT_VSTUFF *vs) { - WT_BUF *tmp; WT_CELL *cell; WT_CELL_UNPACK *unpack, _unpack; WT_COL *cip; + WT_ITEM *tmp; WT_REF *ref; uint64_t recno; const uint8_t *addr; @@ -348,8 +348,7 @@ __verify_row_int_key_order(WT_SESSION_IMPL *session, item.size = ikey->size; /* Compare the key against the largest key we've seen so far. */ - WT_RET( - WT_BTREE_CMP(session, btree, &item, (WT_ITEM *)vs->max_key, cmp)); + WT_RET(WT_BTREE_CMP(session, btree, &item, vs->max_key, cmp)); if (cmp <= 0) WT_RET_MSG(session, WT_ERROR, "the internal key in entry %" PRIu32 " on the page at %s " @@ -406,7 +405,7 @@ __verify_row_leaf_key_order( * OK to compare equally in that case. */ WT_RET(WT_BTREE_CMP(session, - btree, (WT_ITEM *)vs->tmp1, (WT_ITEM *)vs->max_key, cmp)); + btree, vs->tmp1, (WT_ITEM *)vs->max_key, cmp)); if (cmp < 0) WT_RET_MSG(session, WT_ERROR, "the first key on the page at %s sorts equal to or " diff --git a/src/btree/bt_vrfy_dsk.c b/src/btree/bt_vrfy_dsk.c index 76a3f50d738..610fce614a1 100644 --- a/src/btree/bt_vrfy_dsk.c +++ b/src/btree/bt_vrfy_dsk.c @@ -125,9 +125,9 @@ __verify_dsk_row( WT_SESSION_IMPL *session, const char *addr, WT_PAGE_HEADER *dsk) { WT_BTREE *btree; - WT_BUF *current, *last, *last_pfx, *last_ovfl; WT_CELL *cell; WT_CELL_UNPACK *unpack, _unpack; + WT_ITEM *current, *last, *last_pfx, *last_ovfl; enum { FIRST, WAS_KEY, WAS_VALUE } last_cell_type; void *huffman; uint32_t cell_num, cell_type, i, prefix; @@ -313,8 +313,8 @@ key_compare: /* */ if ((dsk->type == WT_PAGE_ROW_INT && cell_num > 3) || (dsk->type != WT_PAGE_ROW_INT && cell_num > 1)) { - WT_ERR(WT_BTREE_CMP(session, btree, - (WT_ITEM *)last, (WT_ITEM *)current, cmp)); + WT_ERR( + WT_BTREE_CMP(session, btree, last, current, cmp)); if (cmp >= 0) WT_ERR_VRFY(session, "the %" PRIu32 " and %" PRIu32 " keys on " diff --git a/src/btree/col_modify.c b/src/btree/col_modify.c index 67778588023..ba59dad2404 100644 --- a/src/btree/col_modify.c +++ b/src/btree/col_modify.c @@ -18,8 +18,8 @@ int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int op) { WT_BTREE *btree; - WT_BUF *value, _value; WT_INSERT *ins, *ins_copy; + WT_ITEM *value, _value; WT_PAGE *page; WT_SKIP_HEAD **inshead, *new_inshead, **new_inslist; WT_UPDATE *upd; diff --git a/src/btree/rec_track.c b/src/btree/rec_track.c index 70eb26c5380..db9394258ce 100644 --- a/src/btree/rec_track.c +++ b/src/btree/rec_track.c @@ -388,7 +388,7 @@ static void __track_msg( WT_SESSION_IMPL *session, WT_PAGE *page, const char *msg, WT_ADDR *addr) { - WT_BUF *buf; + WT_ITEM *buf; if (__wt_scr_alloc(session, 64, &buf)) return; diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c index 24506cbc7d9..3156bb8352b 100644 --- a/src/btree/rec_write.c +++ b/src/btree/rec_write.c @@ -21,7 +21,7 @@ struct __rec_boundary; typedef struct __rec_boundary WT_BOUNDARY; typedef struct { WT_PAGE *page; /* Page being reconciled */ - WT_BUF dsk; /* Temporary disk-image buffer */ + WT_ITEM dsk; /* Temporary disk-image buffer */ /* * Reconciliation gets tricky if we have to split a page, that is, if @@ -74,7 +74,7 @@ typedef struct { * because the page's recno, stored in the recno field, is the * column-store key. */ - WT_BUF key; /* Promoted row-store key */ + WT_ITEM key; /* Promoted row-store key */ } *bnd; /* Saved boundaries */ uint32_t bnd_next; /* Next boundary slot */ uint32_t bnd_entries; /* Total boundary slots */ @@ -127,14 +127,14 @@ typedef struct { * An on-page key/value item we're building. */ struct __rec_kv { - WT_BUF buf; /* Data */ + WT_ITEM buf; /* Data */ WT_CELL cell; /* Cell and cell's length */ uint32_t cell_len; uint32_t len; /* Total length of cell + data */ } k, v; /* Key/Value being built */ - WT_BUF *cur, _cur; /* Key/Value being built */ - WT_BUF *last, _last; /* Last key/value built */ + WT_ITEM *cur, _cur; /* Key/Value being built */ + WT_ITEM *last, _last; /* Last key/value built */ int key_pfx_compress; /* If can prefix-compress next key */ int key_pfx_compress_conf; /* If prefix compression configured */ @@ -157,7 +157,7 @@ static int __rec_col_int(WT_SESSION_IMPL *, WT_PAGE *); static int __rec_col_merge(WT_SESSION_IMPL *, WT_PAGE *); static int __rec_col_var(WT_SESSION_IMPL *, WT_PAGE *, WT_SALVAGE_COOKIE *); static int __rec_col_var_helper(WT_SESSION_IMPL *, - WT_SALVAGE_COOKIE *, WT_BUF *, int, int, uint64_t); + WT_SALVAGE_COOKIE *, WT_ITEM *, int, int, uint64_t); static int __rec_row_int(WT_SESSION_IMPL *, WT_PAGE *); static int __rec_row_leaf(WT_SESSION_IMPL *, WT_PAGE *, WT_SALVAGE_COOKIE *); static int __rec_row_leaf_insert(WT_SESSION_IMPL *, WT_INSERT *); @@ -169,7 +169,7 @@ static int __rec_split_fixup(WT_SESSION_IMPL *); static int __rec_split_init(WT_SESSION_IMPL *, WT_PAGE *, uint64_t, uint32_t); static int __rec_split_row(WT_SESSION_IMPL *, WT_PAGE *, WT_PAGE **); static int __rec_split_row_promote(WT_SESSION_IMPL *, uint8_t); -static int __rec_split_write(WT_SESSION_IMPL *, WT_BOUNDARY *, WT_BUF *); +static int __rec_split_write(WT_SESSION_IMPL *, WT_BOUNDARY *, WT_ITEM *); static int __rec_write_init(WT_SESSION_IMPL *, WT_PAGE *); static int __rec_write_wrapup(WT_SESSION_IMPL *, WT_PAGE *); @@ -370,7 +370,7 @@ __rec_copy_incr(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_KV *kv) /* * If there's only one chunk of data to copy (because the cell and data * are being copied from the original disk page), the cell length won't - * be set, the WT_BUF data/length will reference the data to be copied. + * be set, the WT_ITEM data/length will reference the data to be copied. * * WT_CELLs are typically small, 1 or 2 bytes -- don't call memcpy, do * the copy in-line. @@ -394,7 +394,7 @@ __rec_copy_incr(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_KV *kv) static inline void __rec_key_state_update(WT_RECONCILE *r, int ovfl_key) { - WT_BUF *a; + WT_ITEM *a; /* * If writing an overflow key onto the page, don't update the "last key" @@ -758,7 +758,7 @@ __rec_split_fixup(WT_SESSION_IMPL *session) { WT_BTREE *btree; WT_BOUNDARY *bnd; - WT_BUF *tmp; + WT_ITEM *tmp; WT_PAGE_HEADER *dsk; WT_RECONCILE *r; uint32_t i, len; @@ -835,7 +835,7 @@ err: __wt_scr_free(&tmp); * Write a disk block out for the split helper functions. */ static int -__rec_split_write(WT_SESSION_IMPL *session, WT_BOUNDARY *bnd, WT_BUF *buf) +__rec_split_write(WT_SESSION_IMPL *session, WT_BOUNDARY *bnd, WT_ITEM *buf) { WT_CELL *cell; WT_PAGE_HEADER *dsk; @@ -1434,7 +1434,7 @@ __rec_col_fix_slvg( static int __rec_col_var_helper( WT_SESSION_IMPL *session, WT_SALVAGE_COOKIE *salvage, - WT_BUF *value, int deleted, int raw, uint64_t rle) + WT_ITEM *value, int deleted, int raw, uint64_t rle) { WT_RECONCILE *r; WT_KV *val; @@ -1508,11 +1508,11 @@ __rec_col_var( WT_SESSION_IMPL *session, WT_PAGE *page, WT_SALVAGE_COOKIE *salvage) { WT_BTREE *btree; - WT_BUF *last, orig; WT_CELL *cell; WT_CELL_UNPACK *unpack, _unpack; WT_COL *cip; WT_INSERT *ins; + WT_ITEM *last, orig; WT_RECONCILE *r; WT_SKIP_HEAD *append; WT_UPDATE *upd; @@ -2134,11 +2134,11 @@ static int __rec_row_leaf( WT_SESSION_IMPL *session, WT_PAGE *page, WT_SALVAGE_COOKIE *salvage) { - WT_BUF *tmpkey; WT_CELL *cell, *val_cell; WT_CELL_UNPACK *unpack, _unpack; WT_IKEY *ikey; WT_INSERT *ins; + WT_ITEM *tmpkey; WT_KV *key, *val; WT_RECONCILE *r; WT_ROW *rip; @@ -2296,16 +2296,16 @@ __rec_row_leaf( tmpkey->size >= unpack->prefix) { /* * If we previously built a prefix-compressed - * key in the temporary buffer, WT_BUF->data - * will be the same as WT_BUF->mem: grow the + * key in the temporary buffer, WT_ITEM->data + * will be the same as WT_ITEM->mem: grow the * buffer if necessary and copy the suffix into * place. * * If we previously pointed the temporary buffer - * at an on-page key, WT_BUF->data will not be - * the same as WT_BUF->mem: grow the buffer if + * at an on-page key, WT_ITEM->data will not be + * the same as WT_ITEM->mem: grow the buffer if * necessary, copy the prefix into place, then - * re-point the WT_BUF->data field to the newly + * re-point the WT_ITEM->data field to the newly * constructed memory, and then copy the suffix * into place. */ @@ -2524,7 +2524,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) bnd = &r->bnd[0]; #ifdef HAVE_VERBOSE if (WT_VERBOSE_ISSET(session, reconcile)) { - WT_BUF *buf; + WT_ITEM *buf; WT_RET(__wt_scr_alloc(session, 64, &buf)); WT_VERBOSE(session, reconcile, "page %p written to %s", page, __wt_addr_string( @@ -2557,7 +2557,7 @@ __rec_write_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) #ifdef HAVE_VERBOSE if (WT_VERBOSE_ISSET(session, reconcile)) { - WT_BUF *tkey; + WT_ITEM *tkey; if (page->type == WT_PAGE_ROW_INT || page->type == WT_PAGE_ROW_LEAF) WT_RET(__wt_scr_alloc(session, 0, &tkey)); @@ -2904,7 +2904,7 @@ __rec_cell_build_ovfl( WT_SESSION_IMPL *session, WT_KV *kv, uint8_t type, uint64_t rle) { WT_BTREE *btree; - WT_BUF *tmp; + WT_ITEM *tmp; WT_PAGE *page; WT_PAGE_HEADER *dsk; WT_RECONCILE *r; diff --git a/src/btree/row_key.c b/src/btree/row_key.c index 6bab019130f..9cff462ed22 100644 --- a/src/btree/row_key.c +++ b/src/btree/row_key.c @@ -17,7 +17,7 @@ int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_BTREE *btree; - WT_BUF *tmp; + WT_ITEM *tmp; WT_ROW *rip; uint32_t i; int ret; @@ -104,12 +104,12 @@ __inmem_row_leaf_slots( */ int __wt_row_key( - WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, WT_BUF *retb) + WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, WT_ITEM *retb) { enum { FORWARD, BACKWARD } direction; - WT_BUF *tmp; WT_CELL_UNPACK *unpack, _unpack; WT_IKEY *ikey; + WT_ITEM *tmp; WT_ROW *rip; int is_local, ret, slot_offset; void *key; diff --git a/src/btree/row_modify.c b/src/btree/row_modify.c index 53763584e08..767b84d4afb 100644 --- a/src/btree/row_modify.c +++ b/src/btree/row_modify.c @@ -14,8 +14,8 @@ int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove) { - WT_BUF *key, *value; WT_INSERT *ins; + WT_ITEM *key, *value; WT_SKIP_HEAD **inshead, *new_inshead, **new_inslist; WT_PAGE *page; WT_UPDATE **new_upd, *upd, **upd_entry; @@ -156,7 +156,7 @@ err: if (ins != NULL) */ int __wt_row_insert_alloc(WT_SESSION_IMPL *session, - WT_BUF *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep) + WT_ITEM *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep) { WT_INSERT *ins; size_t ins_size; @@ -253,7 +253,7 @@ err: __wt_session_serialize_wrapup(session, page, ret); */ int __wt_update_alloc(WT_SESSION_IMPL *session, - WT_BUF *value, WT_UPDATE **updp, size_t *sizep) + WT_ITEM *value, WT_UPDATE **updp, size_t *sizep) { WT_UPDATE *upd; size_t size; diff --git a/src/btree/row_srch.c b/src/btree/row_srch.c index f4b5f82a92a..65936ffaf31 100644 --- a/src/btree/row_srch.c +++ b/src/btree/row_srch.c @@ -99,7 +99,7 @@ __wt_row_search(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_modify) __cursor_search_clear(cbt); - srch_key = (WT_ITEM *)&cbt->iface.key; + srch_key = &cbt->iface.key; btree = session->btree; unpack = &_unpack; diff --git a/src/config/config_collapse.c b/src/config/config_collapse.c index 62210544ded..ca0c863ea55 100644 --- a/src/config/config_collapse.c +++ b/src/config/config_collapse.c @@ -17,9 +17,9 @@ int __wt_config_collapse(WT_SESSION_IMPL *session, const char **cfg, const char **config_ret) { - WT_BUF buf; WT_CONFIG cparser; WT_CONFIG_ITEM k, v; + WT_ITEM buf; int ret; WT_CLEAR(buf); diff --git a/src/config/config_concat.c b/src/config/config_concat.c index 09b061eef56..6bbee5ee77e 100644 --- a/src/config/config_concat.c +++ b/src/config/config_concat.c @@ -21,9 +21,9 @@ int __wt_config_concat( WT_SESSION_IMPL *session, const char **cfg, const char **config_ret) { - WT_BUF buf; WT_CONFIG cparser; WT_CONFIG_ITEM k, v; + WT_ITEM buf; int ret; const char **cp; diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 55972936f3a..71f33d71ba3 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -7,7 +7,7 @@ #include "wt_internal.h" -static int __conn_config(WT_CONNECTION_IMPL *, const char **, WT_BUF **); +static int __conn_config(WT_CONNECTION_IMPL *, const char **, WT_ITEM **); static int __conn_home(WT_CONNECTION_IMPL *, const char *, const char **); static int __conn_single(WT_CONNECTION_IMPL *, const char **); @@ -370,10 +370,10 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, { "write", WT_VERB_write }, { NULL, 0 } }; - WT_BUF *cbuf, expath, exconfig; WT_CONFIG subconfig; WT_CONFIG_ITEM cval, skey, sval; WT_CONNECTION_IMPL *conn; + WT_ITEM *cbuf, expath, exconfig; WT_SESSION_IMPL *session; int ret; const char *cfg[] = @@ -672,9 +672,9 @@ err: if (conn->lock_fh != NULL) { * Read in any WiredTiger_config file in the home directory. */ static int -__conn_config(WT_CONNECTION_IMPL *conn, const char **cfg, WT_BUF **cbufp) +__conn_config(WT_CONNECTION_IMPL *conn, const char **cfg, WT_ITEM **cbufp) { - WT_BUF *cbuf; + WT_ITEM *cbuf; WT_FH *fh; WT_SESSION_IMPL *session; off_t size; diff --git a/src/cursor/cur_config.c b/src/cursor/cur_config.c index 937525f164c..14e6210d4e9 100644 --- a/src/cursor/cur_config.c +++ b/src/cursor/cur_config.c @@ -47,8 +47,8 @@ __wt_curconfig_open(WT_SESSION_IMPL *session, { NULL, NULL }, /* TAILQ_ENTRY q */ 0, /* recno key */ { 0 }, /* recno raw buffer */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF key */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF value */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM key */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM value */ 0, /* int saved_err */ 0 /* uint32_t flags */ }; diff --git a/src/cursor/cur_dump.c b/src/cursor/cur_dump.c index 0a37f1e1536..477bb70e4a5 100644 --- a/src/cursor/cur_dump.c +++ b/src/cursor/cur_dump.c @@ -14,9 +14,9 @@ */ static int __raw_to_dump( - WT_SESSION_IMPL *session, WT_ITEM *from, WT_BUF *to, int hexonly) + WT_SESSION_IMPL *session, WT_ITEM *from, WT_ITEM *to, int hexonly) { - WT_BUF *tmp; + WT_ITEM *tmp; uint32_t size; /* diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index d5bfbaef601..e42ffe951cf 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -237,8 +237,8 @@ __wt_curfile_create(WT_SESSION_IMPL *session, { NULL, NULL }, /* TAILQ_ENTRY q */ 0, /* recno key */ { 0 }, /* recno raw buffer */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF key */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF value */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM key */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM value */ 0, /* int saved_err */ 0 /* uint32_t flags */ }; diff --git a/src/cursor/cur_index.c b/src/cursor/cur_index.c index 24fbfcf5e6a..9a16fd47983 100644 --- a/src/cursor/cur_index.c +++ b/src/cursor/cur_index.c @@ -68,8 +68,8 @@ __curindex_set_value(WT_CURSOR *cursor, ...) static int __curindex_move(WT_CURSOR_INDEX *cindex) { - WT_BUF *firstkey; WT_CURSOR **cp; + WT_ITEM *firstkey; WT_SESSION_IMPL *session; uint64_t recno; int i; @@ -91,7 +91,7 @@ __curindex_move(WT_CURSOR_INDEX *cindex) WT_RET(__wt_schema_project_slice(session, cp, cindex->cbt.btree->key_plan, 1, cindex->cbt.btree->key_format, - (WT_ITEM *)&cindex->cbt.iface.key)); + &cindex->cbt.iface.key)); firstkey = &(*cp)->key; recno = (*cp)->recno; } else { @@ -194,7 +194,7 @@ static int __curindex_search(WT_CURSOR *cursor) { WT_CURSOR_INDEX *cindex; - WT_BUF *oldkeyp; + WT_ITEM *oldkeyp; WT_SESSION_IMPL *session; int exact, ret; @@ -346,7 +346,7 @@ int __wt_curindex_open(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], WT_CURSOR **cursorp) { - WT_BUF fmt, plan; + WT_ITEM fmt, plan; static WT_CURSOR iface = { NULL, NULL, @@ -368,8 +368,8 @@ __wt_curindex_open(WT_SESSION_IMPL *session, { NULL, NULL }, /* TAILQ_ENTRY q */ 0, /* recno key */ { 0 }, /* recno raw buffer */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF key */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF value */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM key */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM value */ 0, /* int saved_err */ 0 /* uint32_t flags */ }; diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index c948dbcfce2..32aec19551a 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -15,7 +15,7 @@ static int __curstat_prev(WT_CURSOR *cursor); * Convert statistics cursor value to printable format. */ static int -__curstat_print_value(WT_SESSION_IMPL *session, uint64_t v, WT_BUF *buf) +__curstat_print_value(WT_SESSION_IMPL *session, uint64_t v, WT_ITEM *buf) { if (v >= WT_BILLION) WT_RET(__wt_buf_fmt(session, buf, @@ -339,8 +339,8 @@ __wt_curstat_open(WT_SESSION_IMPL *session, { NULL, NULL }, /* TAILQ_ENTRY q */ 0, /* recno key */ { 0 }, /* recno raw buffer */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF key */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF value */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM key */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM value */ 0, /* int saved_err */ 0 /* uint32_t flags */ }; diff --git a/src/cursor/cur_std.c b/src/cursor/cur_std.c index c8442f9f7e6..44df031ad83 100644 --- a/src/cursor/cur_std.c +++ b/src/cursor/cur_std.c @@ -122,8 +122,7 @@ void __wt_cursor_set_keyv(WT_CURSOR *cursor, uint32_t flags, va_list ap) { WT_SESSION_IMPL *session; - WT_BUF *buf; - WT_ITEM *item; + WT_ITEM *buf, *item; va_list ap_copy; const char *fmt, *str; size_t sz; @@ -194,8 +193,7 @@ void __wt_cursor_set_value(WT_CURSOR *cursor, ...) { WT_SESSION_IMPL *session; - WT_BUF *buf; - WT_ITEM *item; + WT_ITEM *buf, *item; const char *fmt, *str; size_t sz; va_list ap; diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c index f80a1c99103..915b10a8a68 100644 --- a/src/cursor/cur_table.c +++ b/src/cursor/cur_table.c @@ -153,7 +153,7 @@ __wt_curtable_set_value(WT_CURSOR *cursor, ...) cursor->value.size = item->size; ret = __wt_schema_project_slice(session, ctable->cg_cursors, ctable->plan, 0, - cursor->value_format, (WT_ITEM *)&cursor->value); + cursor->value_format, &cursor->value); } else ret = __wt_schema_project_in(session, ctable->cg_cursors, ctable->plan, ap); @@ -371,7 +371,7 @@ __curtable_update(WT_CURSOR *cursor) APPLY_IDX(ctable, remove); WT_ERR(__wt_schema_project_slice(session, ctable->cg_cursors, ctable->plan, 0, - cursor->value_format, (WT_ITEM *)&cursor->value)); + cursor->value_format, &cursor->value)); } APPLY_CG(ctable, update); if (ctable->idx_cursors != NULL) @@ -542,15 +542,15 @@ __wt_curtable_open(WT_SESSION_IMPL *session, { NULL, NULL }, /* TAILQ_ENTRY q */ 0, /* recno key */ { 0 }, /* raw recno buffer */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF key */ - { NULL, 0, 0, NULL, 0 },/* WT_BUF value */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM key */ + { NULL, 0, 0, NULL, 0 },/* WT_ITEM value */ 0, /* int saved_err */ 0 /* uint32_t flags */ }; - WT_BUF fmt, plan; WT_CONFIG_ITEM cval; WT_CURSOR *cursor; WT_CURSOR_TABLE *ctable; + WT_ITEM fmt, plan; WT_TABLE *table; size_t size; int ret; diff --git a/src/include/api.h b/src/include/api.h index 63cb9530fd0..296adc0f1dc 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -75,10 +75,10 @@ struct __wt_session_impl { WT_BTREE *schematab; /* Schema tables */ TAILQ_HEAD(__tables, __wt_table) tables; - WT_BUF logrec_buf; /* Buffer for log records */ - WT_BUF logprint_buf; /* Buffer for debug log records */ + WT_ITEM logrec_buf; /* Buffer for log records */ + WT_ITEM logprint_buf; /* Buffer for debug log records */ - WT_BUF **scratch; /* Temporary memory for any function */ + WT_ITEM **scratch; /* Temporary memory for any function */ u_int scratch_alloc; /* Currently allocated */ /* Serialized operation state */ @@ -264,7 +264,6 @@ extern WT_PROCESS __wt_process; * DO NOT EDIT: automatically built by dist/api_flags.py. * API flags section: BEGIN */ -#define WT_BUF_INUSE 0x00000001 #define WT_PAGE_FREE_IGNORE_DISK 0x00000001 #define WT_REC_SINGLE 0x00000001 #define WT_SERVER_RUN 0x00000001 diff --git a/src/include/cursor.h b/src/include/cursor.h index f281d0bc4ee..c3310ff6056 100644 --- a/src/include/cursor.h +++ b/src/include/cursor.h @@ -73,7 +73,7 @@ struct __wt_cursor_btree { * A temporary buffer with two uses: caching RLE values for column-store * files, and caching the last-returned keys for row-store files. */ - WT_BUF tmp; + WT_ITEM tmp; /* * Fixed-length column-store items are a single byte, and it's simpler @@ -100,7 +100,7 @@ struct __wt_cursor_bulk { * part of RLE compression, row-store compares keys during bulk load * to avoid corruption. */ - WT_BUF cmp; /* Comparison buffer */ + WT_ITEM cmp; /* Comparison buffer */ /* * Variable-length column-store RLE counter (also overloaded to mean @@ -138,7 +138,7 @@ struct __wt_cursor_stat { int key; /* Current stats key */ uint64_t v; /* Current stats value */ - WT_BUF pv; /* Current stats value (string) */ + WT_ITEM pv; /* Current stats value (string) */ void (*clear_func)(WT_STATS *); /* Function to clear stats. */ WT_BTREE *btree; /* Pinned btree handle. */ diff --git a/src/include/cursor.i b/src/include/cursor.i index 3fc8b5d5b5b..cea5ac359f9 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -87,7 +87,7 @@ static inline int __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip) { WT_BTREE *btree; - WT_BUF *kb, *vb; + WT_ITEM *kb, *vb; WT_CELL *cell; WT_CELL_UNPACK *unpack, _unpack; WT_IKEY *ikey; @@ -147,14 +147,14 @@ __cursor_row_slot_return(WT_CURSOR_BTREE *cbt, WT_ROW *rip) cbt->rip_saved != NULL && cbt->rip_saved == rip - 1) { /* * If we previously built a prefix-compressed key in the - * temporary buffer, the WT_BUF->data field will be the - * same as the WT_BUF->mem field: grow the buffer if + * temporary buffer, the WT_ITEM->data field will be the + * same as the WT_ITEM->mem field: grow the buffer if * necessary and copy the suffix into place. If we * previously pointed the temporary buffer at an on-page - * key, the WT_BUF->data field will not be the same as - * the WT_BUF->mem field: grow the buffer if necessary, + * key, the WT_ITEM->data field will not be the same as + * the WT_ITEM->mem field: grow the buffer if necessary, * copy the prefix into place, and then re-point the - * WT_BUF->data field to the newly constructed memory. + * WT_ITEM->data field to the newly constructed memory. */ WT_RET(__wt_buf_grow( session, &cbt->tmp, unpack->prefix + unpack->size)); diff --git a/src/include/extern.h b/src/include/extern.h index d8f70d2c9d3..4f8973d5c11 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -16,7 +16,7 @@ extern int __wt_block_addr_valid(WT_SESSION_IMPL *session, uint32_t addr_size); extern int __wt_block_addr_string(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_block_alloc( WT_SESSION_IMPL *session, @@ -47,7 +47,7 @@ extern int __wt_bm_addr_stderr( WT_SESSION_IMPL *session, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_addr_string(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_create(WT_SESSION_IMPL *session, const char *filename); @@ -62,19 +62,19 @@ extern int __wt_bm_free(WT_SESSION_IMPL *session, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_read(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_bm_block_header(WT_SESSION_IMPL *session, uint32_t *headerp); extern int __wt_bm_write_size(WT_SESSION_IMPL *session, uint32_t *sizep); extern int __wt_bm_write( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_size); extern int __wt_bm_stat(WT_SESSION_IMPL *session); extern int __wt_bm_salvage_start(WT_SESSION_IMPL *session); extern int __wt_bm_salvage_next(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_sizep, uint64_t *write_genp, @@ -97,12 +97,12 @@ extern int __wt_block_close(WT_SESSION_IMPL *session, WT_BLOCK *block); extern int __wt_desc_init(WT_SESSION_IMPL *session, WT_FH *fh); extern int __wt_block_read_buf(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t addr_size); extern int __wt_block_read(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, off_t offset, uint32_t size, uint32_t cksum); @@ -112,7 +112,7 @@ extern int __wt_block_salvage_end(WT_SESSION_IMPL *session, int success); extern int __wt_block_salvage_next( WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_sizep, uint64_t *write_genp, @@ -133,12 +133,12 @@ extern int __wt_block_write_size( WT_SESSION_IMPL *session, uint32_t *sizep); extern int __wt_block_write_buf(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, uint8_t *addr, uint32_t *addr_size); extern int __wt_block_write(WT_SESSION_IMPL *session, WT_BLOCK *block, - WT_BUF *buf, + WT_ITEM *buf, off_t *offsetp, uint32_t *sizep, uint32_t *cksump); @@ -150,10 +150,10 @@ extern void __wt_cache_stats_update(WT_CONNECTION_IMPL *conn); extern void __wt_cache_destroy(WT_CONNECTION_IMPL *conn); extern int __wt_cell_copy(WT_SESSION_IMPL *session, WT_CELL *cell, - WT_BUF *retb); + WT_ITEM *retb); extern int __wt_cell_unpack_copy( WT_SESSION_IMPL *session, WT_CELL_UNPACK *unpack, - WT_BUF *retb); + WT_ITEM *retb); extern void __wt_btcur_iterate_setup(WT_CURSOR_BTREE *cbt, int next); extern int __wt_btcur_first(WT_CURSOR_BTREE *cbt); extern int __wt_btcur_next(WT_CURSOR_BTREE *cbt); @@ -198,7 +198,7 @@ extern int __wt_btree_open(WT_SESSION_IMPL *session, const char *cfg[], uint32_t flags); extern int __wt_btree_reopen(WT_SESSION_IMPL *session, uint32_t flags); -extern int __wt_btree_root_init(WT_SESSION_IMPL *session, WT_BUF *addr); +extern int __wt_btree_root_init(WT_SESSION_IMPL *session, WT_ITEM *addr); extern int __wt_btree_root_empty(WT_SESSION_IMPL *session, WT_PAGE **leafp); extern int __wt_btree_close(WT_SESSION_IMPL *session); extern int __wt_btree_huffman_open(WT_SESSION_IMPL *session, @@ -207,14 +207,14 @@ extern void __wt_btree_huffman_close(WT_SESSION_IMPL *session); extern const char *__wt_page_type_string(u_int type); extern const char *__wt_cell_type_string(uint8_t type); extern const char *__wt_page_addr_string(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, WT_PAGE *page); extern const char *__wt_addr_string( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const uint8_t *addr, uint32_t size); extern int __wt_ovfl_in( WT_SESSION_IMPL *session, - WT_BUF *store, + WT_ITEM *store, const uint8_t *addr, uint32_t len); extern int @@ -236,7 +236,7 @@ extern int __wt_cache_read(WT_SESSION_IMPL *session, extern int __wt_kv_return(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int key_ret); -extern int __wt_btree_get_root(WT_SESSION_IMPL *session, WT_BUF *addr); +extern int __wt_btree_get_root(WT_SESSION_IMPL *session, WT_ITEM *addr); extern int __wt_btree_free_root(WT_SESSION_IMPL *session); extern int __wt_btree_set_root(WT_SESSION_IMPL *session, uint8_t *addr, @@ -299,7 +299,7 @@ extern int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page); extern int __wt_row_key( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip_arg, - WT_BUF *retb); + WT_ITEM *retb); extern WT_CELL *__wt_row_value(WT_PAGE *page, WT_ROW *rip); extern int __wt_row_ikey_alloc(WT_SESSION_IMPL *session, uint32_t cell_offset, @@ -311,13 +311,13 @@ extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, int is_remove); extern int __wt_row_insert_alloc(WT_SESSION_IMPL *session, - WT_BUF *key, + WT_ITEM *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep); extern void __wt_insert_serial_func(WT_SESSION_IMPL *session); extern int __wt_update_alloc(WT_SESSION_IMPL *session, - WT_BUF *value, + WT_ITEM *value, WT_UPDATE **updp, size_t *sizep); extern void __wt_update_serial_func(WT_SESSION_IMPL *session); @@ -641,18 +641,18 @@ extern int __wt_struct_plan(WT_SESSION_IMPL *session, const char *columns, size_t len, int value_only, - WT_BUF *plan); + WT_ITEM *plan); extern int __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, const char *extra_cols, int value_only, - WT_BUF *format); + WT_ITEM *format); extern int __wt_struct_truncate(WT_SESSION_IMPL *session, const char *input_fmt, u_int ncols, - WT_BUF *format); + WT_ITEM *format); extern int __wt_schema_project_in(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, @@ -671,7 +671,7 @@ extern int __wt_schema_project_merge(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, const char *vformat, - WT_BUF *value); + WT_ITEM *value); extern int __wt_schema_rename(WT_SESSION_IMPL *session, const char *uri, const char *newname, @@ -811,50 +811,50 @@ extern int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, - WT_BUF *to_buf); + WT_ITEM *to_buf); extern int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, const uint8_t *from_arg, uint32_t from_len, - WT_BUF *to_buf); + WT_ITEM *to_buf); extern uint32_t __wt_nlpo2_round(uint32_t v); extern uint32_t __wt_nlpo2(uint32_t v); extern int __wt_ispo2(uint32_t v); extern uint32_t __wt_random(void); -extern int __wt_buf_init(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +extern int __wt_buf_init(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size); extern int __wt_buf_initsize(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, size_t size); -extern int __wt_buf_grow(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size); +extern int __wt_buf_grow(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size); extern int __wt_buf_set( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const void *data, size_t size); extern int __wt_buf_set_printable( WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const void *from_arg, size_t size); extern void *__wt_buf_steal(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, uint32_t *sizep); -extern void __wt_buf_swap(WT_BUF *a, WT_BUF *b); -extern void __wt_buf_free(WT_SESSION_IMPL *session, WT_BUF *buf); +extern void __wt_buf_swap(WT_ITEM *a, WT_ITEM *b); +extern void __wt_buf_free(WT_SESSION_IMPL *session, WT_ITEM *buf); extern int __wt_buf_fmt(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); extern int __wt_buf_catfmt(WT_SESSION_IMPL *session, - WT_BUF *buf, + WT_ITEM *buf, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); extern int __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, - WT_BUF **scratchp); -extern void __wt_scr_free(WT_BUF **bufp); + WT_ITEM **scratchp); +extern void __wt_scr_free(WT_ITEM **bufp); extern void __wt_scr_discard(WT_SESSION_IMPL *session); extern void *__wt_scr_alloc_ext(WT_SESSION *wt_session, size_t size); extern void __wt_scr_free_ext(WT_SESSION *wt_session, void *p); diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 857a51e7961..faa29d7c6fa 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -98,6 +98,18 @@ struct __wt_item { * The number of bytes in the data item. */ uint32_t size; + +#ifndef DOXYGEN +#define WT_ITEM_INUSE 0x00000001 + /* This appears in the middle of the struct to avoid padding. */ + /*! Object flags (internal use). */ + uint32_t flags; + + /*! Managed memory chunk (internal use). */ + void *mem; + /*! Managed memory size (internal use). */ + size_t memsize; +#endif }; /*! @@ -112,36 +124,6 @@ struct __wt_item { */ #define WT_INTPACK32_MAXSIZE ((int)sizeof (int32_t) + 1) -#ifndef DOXYGEN -/* Forward structure declarations */ -struct __wt_buf; typedef struct __wt_buf WT_BUF; - -/*! - * A data item with memory management. Used internally to manage returned keys - * and values in the WT_CURSOR implementation. - */ -struct __wt_buf { - /* - * Note: the first two fields must match WT_ITEM, we cast between - * those types. - */ - /*! The memory reference of the data item. */ - const void *data; - /*! The number of bytes in the data item. */ - uint32_t size; - - /* This appears in the middle of the struct to avoid padding. */ -#define WT_BUF_INUSE 0x00000001 - /*! Object flags (internal use). */ - uint32_t flags; - - /*! Managed memory chunk (internal use). */ - void *mem; - /*! Managed memory size (internal use). */ - size_t memsize; -}; -#endif - /*! * A WT_CURSOR handle is the interface to a cursor. * @@ -399,7 +381,7 @@ struct __wt_cursor { uint64_t recno; uint8_t raw_recno_buf[WT_INTPACK64_MAXSIZE]; /* Holds a recno in raw mode. */ - WT_BUF key, value; + WT_ITEM key, value; int saved_err; /* Saved error in set_{key,value}. */ #define WT_CURSTD_APPEND 0x0001 diff --git a/src/log/log.c b/src/log/log.c index f0ff78242d1..45de4d7beaa 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -20,7 +20,7 @@ __log_record_size(WT_SESSION_IMPL *session, int __wt_log_put(WT_SESSION_IMPL *session, WT_LOGREC_DESC *recdesc, ...) { - WT_BUF *buf; + WT_ITEM *buf; va_list ap; size_t size; int ret; @@ -44,7 +44,7 @@ int __wt_log_vprintf(WT_SESSION_IMPL *session, const char *fmt, va_list ap) { WT_CONNECTION_IMPL *conn; - WT_BUF *buf; + WT_ITEM *buf; va_list ap_copy; size_t len; diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c index 7d3ab7c2046..c06aadd564f 100644 --- a/src/schema/schema_create.c +++ b/src/schema/schema_create.c @@ -11,7 +11,7 @@ int __wt_create_file(WT_SESSION_IMPL *session, const char *name, const char *fileuri, const char *config) { - WT_BUF *key, *val; + WT_ITEM *key, *val; const char *cfg[] = API_CONF_DEFAULTS(session, create, config); const char *filecfg[] = API_CONF_DEFAULTS(file, meta, config); const char *filename, *treeconf; @@ -88,8 +88,8 @@ static int __create_colgroup( WT_SESSION_IMPL *session, const char *name, const char *config) { - WT_BUF fmt, namebuf, uribuf; WT_CONFIG_ITEM cval; + WT_ITEM fmt, namebuf, uribuf; WT_TABLE *table; const char *cfg[] = { __wt_confdfl_colgroup_meta, config, NULL, NULL }; const char *filecfg[] = { config, NULL, NULL }; @@ -184,9 +184,9 @@ err: __wt_free(session, cgconf); static int __create_index(WT_SESSION_IMPL *session, const char *name, const char *config) { - WT_BUF extra_cols, fmt, namebuf, uribuf; WT_CONFIG pkcols; WT_CONFIG_ITEM ckey, cval, icols; + WT_ITEM extra_cols, fmt, namebuf, uribuf; WT_TABLE *table; const char *cfg[] = { __wt_confdfl_index_meta, config, NULL, NULL }; const char *filecfg[] = { config, NULL, NULL }; diff --git a/src/schema/schema_drop.c b/src/schema/schema_drop.c index ec6b44842a3..32bb2c7fe63 100644 --- a/src/schema/schema_drop.c +++ b/src/schema/schema_drop.c @@ -15,7 +15,7 @@ int __wt_drop_file(WT_SESSION_IMPL *session, const char *name, int force) { static const char *list[] = { "file", "root", "version", NULL }; - WT_BUF *buf; + WT_ITEM *buf; int exist, ret; const char **lp; @@ -51,7 +51,7 @@ err: __wt_scr_free(&buf); static int __drop_tree(WT_SESSION_IMPL *session, WT_BTREE *btree, int force) { - WT_BUF *buf; + WT_ITEM *buf; int ret; ret = 0; diff --git a/src/schema/schema_open.c b/src/schema/schema_open.c index 45a4edca05c..6baef31910c 100644 --- a/src/schema/schema_open.c +++ b/src/schema/schema_open.c @@ -49,7 +49,7 @@ int __wt_schema_get_btree(WT_SESSION_IMPL *session, const char *objname, size_t len, const char *cfg[], uint32_t flags) { - WT_BUF uribuf; + WT_ITEM uribuf; WT_CONFIG_ITEM cval; WT_CURSOR *cursor; const char *fileuri, *name, *objconf; @@ -99,9 +99,9 @@ err: __wt_buf_free(session, &uribuf); int __wt_schema_open_colgroups(WT_SESSION_IMPL *session, WT_TABLE *table) { - WT_BUF plan; WT_CONFIG cparser; WT_CONFIG_ITEM ckey, cval; + WT_ITEM plan; char *cgname; const char *fileconf; int i, ret; @@ -162,9 +162,9 @@ __open_index(WT_SESSION_IMPL *session, WT_TABLE *table, const char *uri, const char *idxconf, WT_BTREE **btreep) { WT_BTREE *btree; - WT_BUF cols, fmt, plan, uribuf; WT_CONFIG colconf; WT_CONFIG_ITEM ckey, cval, icols; + WT_ITEM cols, fmt, plan, uribuf; const char *fileuri; u_int cursor_key_cols; int i, ret; diff --git a/src/schema/schema_plan.c b/src/schema/schema_plan.c index da8ac98ba38..802ec4b275d 100644 --- a/src/schema/schema_plan.c +++ b/src/schema/schema_plan.c @@ -125,7 +125,7 @@ __wt_table_check(WT_SESSION_IMPL *session, WT_TABLE *table) */ int __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, - const char *columns, size_t len, int value_only, WT_BUF *plan) + const char *columns, size_t len, int value_only, WT_ITEM *plan) { WT_CONFIG conf; WT_CONFIG_ITEM k, v; @@ -245,7 +245,7 @@ __find_column_format(WT_SESSION_IMPL *session, int __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, const char *columns, size_t len, const char *extra_cols, int value_only, - WT_BUF *format) + WT_ITEM *format) { WT_CONFIG config; WT_CONFIG_ITEM k, next_k, next_v; @@ -305,7 +305,7 @@ __wt_struct_reformat(WT_SESSION_IMPL *session, WT_TABLE *table, */ int __wt_struct_truncate(WT_SESSION_IMPL *session, - const char *input_fmt, u_int ncols, WT_BUF *format) + const char *input_fmt, u_int ncols, WT_ITEM *format) { WT_PACK pack; WT_PACK_VALUE pv; diff --git a/src/schema/schema_project.c b/src/schema/schema_project.c index 1aa9d92d06c..4602692cd21 100644 --- a/src/schema/schema_project.c +++ b/src/schema/schema_project.c @@ -16,8 +16,8 @@ int __wt_schema_project_in(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, va_list ap) { - WT_BUF *buf; WT_CURSOR *c; + WT_ITEM *buf; WT_PACK pack; WT_PACK_VALUE pv; char *proj; @@ -218,8 +218,8 @@ int __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, const char *proj_arg, int key_only, const char *vformat, WT_ITEM *value) { - WT_BUF *buf; WT_CURSOR *c; + WT_ITEM *buf; WT_PACK pack, vpack; WT_PACK_VALUE pv, vpv; char *proj; @@ -372,10 +372,10 @@ __wt_schema_project_slice(WT_SESSION_IMPL *session, WT_CURSOR **cp, */ int __wt_schema_project_merge(WT_SESSION_IMPL *session, - WT_CURSOR **cp, const char *proj_arg, const char *vformat, WT_BUF *value) + WT_CURSOR **cp, const char *proj_arg, const char *vformat, WT_ITEM *value) { - WT_BUF *buf; WT_CURSOR *c; + WT_ITEM *buf; WT_PACK pack, vpack; WT_PACK_VALUE pv, vpv; char *proj; diff --git a/src/schema/schema_rename.c b/src/schema/schema_rename.c index 5fc5c42ac1f..053009aaae6 100644 --- a/src/schema/schema_rename.c +++ b/src/schema/schema_rename.c @@ -16,7 +16,7 @@ __rename_file( WT_SESSION_IMPL *session, const char *oldname, const char *newname) { static const char *list[] = { "file", "root", "version", NULL }; - WT_BUF *buf; + WT_ITEM *buf; int exist, ret; const char *value, **lp; @@ -72,7 +72,7 @@ err: __wt_scr_free(&buf); static int __rename_tree(WT_SESSION_IMPL *session, WT_BTREE *btree, const char *newname) { - WT_BUF *of, *nf, *nk, *nv; + WT_ITEM *of, *nf, *nk, *nv; int ret; const char *p, *t, *value; @@ -145,7 +145,7 @@ __rename_table( WT_SESSION_IMPL *session, const char *oldname, const char *newname) { WT_BTREE *btree; - WT_BUF *buf; + WT_ITEM *buf; WT_TABLE *table; int i, ret; const char *value; diff --git a/src/schema/schema_truncate.c b/src/schema/schema_truncate.c index 24e03dd96c1..4da7ce887db 100644 --- a/src/schema/schema_truncate.c +++ b/src/schema/schema_truncate.c @@ -14,7 +14,7 @@ static int __truncate_file(WT_SESSION_IMPL *session, const char *name) { - WT_BUF *uribuf; + WT_ITEM *uribuf; int ret; uribuf = NULL; diff --git a/src/support/huffman.c b/src/support/huffman.c index ecd6582578d..7b66b321b9c 100644 --- a/src/support/huffman.c +++ b/src/support/huffman.c @@ -588,11 +588,11 @@ __wt_print_huffman_code(void *huffman_arg, uint16_t symbol) */ int __wt_huffman_encode(WT_SESSION_IMPL *session, void *huffman_arg, - const uint8_t *from_arg, uint32_t from_len, WT_BUF *to_buf) + const uint8_t *from_arg, uint32_t from_len, WT_ITEM *to_buf) { - WT_BUF *tmp; WT_HUFFMAN_CODE code; WT_HUFFMAN_OBJ *huffman; + WT_ITEM *tmp; uint64_t bitpos; uint32_t max_len, outlen, bytes; const uint8_t *from; @@ -727,9 +727,9 @@ err: __wt_scr_free(&tmp); */ int __wt_huffman_decode(WT_SESSION_IMPL *session, void *huffman_arg, - const uint8_t *from_arg, uint32_t from_len, WT_BUF *to_buf) + const uint8_t *from_arg, uint32_t from_len, WT_ITEM *to_buf) { - WT_BUF *tmp; + WT_ITEM *tmp; WT_HUFFMAN_OBJ *huffman; uint64_t from_len_bits; uint32_t bits, from_bytes, len, mask, max, max_len, outlen; diff --git a/src/support/scratch.c b/src/support/scratch.c index e9b3d22967c..c04b3387f1a 100644 --- a/src/support/scratch.c +++ b/src/support/scratch.c @@ -7,14 +7,14 @@ #include "wt_internal.h" -static void __wt_buf_clear(WT_BUF *); +static void __wt_buf_clear(WT_ITEM *); /* * __wt_buf_clear -- * Clear a buffer. */ static void -__wt_buf_clear(WT_BUF *buf) +__wt_buf_clear(WT_ITEM *buf) { buf->data = NULL; buf->size = 0; @@ -30,7 +30,7 @@ __wt_buf_clear(WT_BUF *buf) * Initialize a buffer at a specific size. */ int -__wt_buf_init(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) +__wt_buf_init(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size) { WT_ASSERT(session, size <= UINT32_MAX); @@ -48,7 +48,7 @@ __wt_buf_init(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) * Initialize a buffer at a specific size, and set the data length. */ int -__wt_buf_initsize(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) +__wt_buf_initsize(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size) { WT_RET(__wt_buf_init(session, buf, size)); @@ -62,7 +62,7 @@ __wt_buf_initsize(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) * Grow a buffer that's currently in-use. */ int -__wt_buf_grow(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) +__wt_buf_grow(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size) { size_t offset; int set_data; @@ -105,7 +105,7 @@ __wt_buf_grow(WT_SESSION_IMPL *session, WT_BUF *buf, size_t size) */ int __wt_buf_set( - WT_SESSION_IMPL *session, WT_BUF *buf, const void *data, size_t size) + WT_SESSION_IMPL *session, WT_ITEM *buf, const void *data, size_t size) { /* Ensure the buffer is large enough. */ WT_RET(__wt_buf_initsize(session, buf, size)); @@ -122,7 +122,7 @@ __wt_buf_set( */ int __wt_buf_set_printable( - WT_SESSION_IMPL *session, WT_BUF *buf, const void *from_arg, size_t size) + WT_SESSION_IMPL *session, WT_ITEM *buf, const void *from_arg, size_t size) { uint32_t u32size; @@ -144,7 +144,7 @@ __wt_buf_set_printable( * Steal a buffer for another purpose. */ void * -__wt_buf_steal(WT_SESSION_IMPL *session, WT_BUF *buf, uint32_t *sizep) +__wt_buf_steal(WT_SESSION_IMPL *session, WT_ITEM *buf, uint32_t *sizep) { void *retp; @@ -186,9 +186,9 @@ __wt_buf_steal(WT_SESSION_IMPL *session, WT_BUF *buf, uint32_t *sizep) * Swap a pair of buffers. */ void -__wt_buf_swap(WT_BUF *a, WT_BUF *b) +__wt_buf_swap(WT_ITEM *a, WT_ITEM *b) { - WT_BUF tmp; + WT_ITEM tmp; tmp = *a; *a = *b; @@ -200,7 +200,7 @@ __wt_buf_swap(WT_BUF *a, WT_BUF *b) * Free a buffer. */ void -__wt_buf_free(WT_SESSION_IMPL *session, WT_BUF *buf) +__wt_buf_free(WT_SESSION_IMPL *session, WT_ITEM *buf) { __wt_free(session, buf->mem); __wt_buf_clear(buf); @@ -211,7 +211,7 @@ __wt_buf_free(WT_SESSION_IMPL *session, WT_BUF *buf) * Grow a buffer to accommodate a formatted string. */ int -__wt_buf_fmt(WT_SESSION_IMPL *session, WT_BUF *buf, const char *fmt, ...) +__wt_buf_fmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...) WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4))) { va_list ap; @@ -244,7 +244,7 @@ __wt_buf_fmt(WT_SESSION_IMPL *session, WT_BUF *buf, const char *fmt, ...) * Grow a buffer to append a formatted string. */ int -__wt_buf_catfmt(WT_SESSION_IMPL *session, WT_BUF *buf, const char *fmt, ...) +__wt_buf_catfmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...) WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4))) { va_list ap; @@ -279,9 +279,9 @@ __wt_buf_catfmt(WT_SESSION_IMPL *session, WT_BUF *buf, const char *fmt, ...) * Scratch buffer allocation function. */ int -__wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) +__wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_ITEM **scratchp) { - WT_BUF *buf, **p, *small, **slot; + WT_ITEM *buf, **p, *small, **slot; size_t allocated; u_int i; int ret; @@ -291,7 +291,7 @@ __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) /* * There's an array of scratch buffers in each WT_SESSION_IMPL that can - * be used by any function. We use WT_BUF structures for scratch + * be used by any function. We use WT_ITEM structures for scratch * memory because we already have to have functions that do * variable-length allocation on WT_BUFs. Scratch buffers are * allocated only by a single thread of control, so no locking is @@ -308,7 +308,7 @@ __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) continue; } - if (F_ISSET(buf, WT_BUF_INUSE)) + if (F_ISSET(buf, WT_ITEM_INUSE)) continue; /* @@ -320,7 +320,7 @@ __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) if (buf->memsize >= size && (buf->memsize - size) < 4 * 1024) { WT_ERR(__wt_buf_init(session, buf, size)); - F_SET(buf, WT_BUF_INUSE); + F_SET(buf, WT_ITEM_INUSE); *scratchp = buf; return (0); } @@ -336,7 +336,7 @@ __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) */ if (small != NULL) { WT_ERR(__wt_buf_init(session, small, size)); - F_SET(small, WT_BUF_INUSE); + F_SET(small, WT_ITEM_INUSE); *scratchp = small; return (0); @@ -355,9 +355,9 @@ __wt_scr_alloc(WT_SESSION_IMPL *session, uint32_t size, WT_BUF **scratchp) * Resize the array, we need more scratch buffers, then call recursively * to find the empty slot, and so on and so forth. */ - allocated = session->scratch_alloc * sizeof(WT_BUF *); + allocated = session->scratch_alloc * sizeof(WT_ITEM *); WT_ERR(__wt_realloc(session, &allocated, - (session->scratch_alloc + 10) * sizeof(WT_BUF *), + (session->scratch_alloc + 10) * sizeof(WT_ITEM *), &session->scratch)); session->scratch_alloc += 10; return (__wt_scr_alloc(session, size, scratchp)); @@ -371,11 +371,11 @@ err: WT_RET_MSG(session, ret, * Release a scratch buffer. */ void -__wt_scr_free(WT_BUF **bufp) +__wt_scr_free(WT_ITEM **bufp) { if (*bufp == NULL) return; - F_CLR(*bufp, WT_BUF_INUSE); + F_CLR(*bufp, WT_ITEM_INUSE); *bufp = NULL; } @@ -386,7 +386,7 @@ __wt_scr_free(WT_BUF **bufp) void __wt_scr_discard(WT_SESSION_IMPL *session) { - WT_BUF **bufp; + WT_ITEM **bufp; u_int i; for (i = 0, @@ -406,7 +406,7 @@ __wt_scr_discard(WT_SESSION_IMPL *session) void * __wt_scr_alloc_ext(WT_SESSION *wt_session, size_t size) { - WT_BUF *buf; + WT_ITEM *buf; WT_SESSION_IMPL *session; session = (WT_SESSION_IMPL *)wt_session; @@ -422,7 +422,7 @@ __wt_scr_alloc_ext(WT_SESSION *wt_session, size_t size) void __wt_scr_free_ext(WT_SESSION *wt_session, void *p) { - WT_BUF **bufp; + WT_ITEM **bufp; WT_SESSION_IMPL *session; u_int i; @@ -435,7 +435,7 @@ __wt_scr_free_ext(WT_SESSION *wt_session, void *p) * Do NOT call __wt_scr_free() here, it clears the * caller's pointer, which would truncate the list. */ - F_CLR(*bufp, WT_BUF_INUSE); + F_CLR(*bufp, WT_ITEM_INUSE); return; } __wt_errx(session, "extension free'd non-existent scratch buffer"); |