1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Olson. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)bt_put.c 8.8 (Berkeley) 7/26/94"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/lib/libc/db/btree/bt_put.c 111010 2003-02-16 17:29:11Z nectar $"); |
42 43#include <sys/types.h> 44 45#include <errno.h> 46#include <stdio.h> 47#include <stdlib.h> 48#include <string.h> 49 --- 170 unchanged lines hidden (view full) --- 220 WR_BLEAF(dest, key, data, dflags); 221 222 /* If the cursor is on this page, adjust it as necessary. */ 223 if (F_ISSET(&t->bt_cursor, CURS_INIT) && 224 !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && 225 t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index) 226 ++t->bt_cursor.pg.index; 227 |
228 if (t->bt_order == NOT) { |
229 if (h->nextpg == P_INVALID) { 230 if (index == NEXTINDEX(h) - 1) { 231 t->bt_order = FORWARD; 232 t->bt_last.index = index; 233 t->bt_last.pgno = h->pgno; 234 } 235 } else if (h->prevpg == P_INVALID) { 236 if (index == 0) { 237 t->bt_order = BACK; 238 t->bt_last.index = 0; 239 t->bt_last.pgno = h->pgno; 240 } 241 } |
242 } |
243 244 mpool_put(t->bt_mp, h, MPOOL_DIRTY); 245 246success: 247 if (flags == R_SETCURSOR) 248 __bt_setcur(t, e->page->pgno, e->index); 249 250 F_SET(t, B_MODIFIED); --- 73 unchanged lines hidden --- |