SCCS-vsn: lib/libc/db/btree/bt_close.c 5.7
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_close.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)bt_close.c 5.7 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "btree.h"
static int bt_meta __P((BTREE *));
#include "btree.h"
static int bt_meta __P((BTREE *));
- if (ISSET(t, BTF_INMEM) || ISSET(t, BTF_RDONLY) ||
- NOTSET(t, BTF_MODIFIED))
+ if (ISSET(t, BTF_INMEM | BTF_RDONLY) || !ISSET(t, BTF_MODIFIED))
return (RET_SUCCESS);
if (ISSET(t, BTF_METADIRTY) && bt_meta(t) == RET_ERROR)
return (RET_SUCCESS);
if (ISSET(t, BTF_METADIRTY) && bt_meta(t) == RET_ERROR)
* contents.
*/
if (ISSET(t, BTF_DELCRSR)) {
* contents.
*/
if (ISSET(t, BTF_DELCRSR)) {
- if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL)
+ if ((p = malloc(t->bt_psize)) == NULL)
- if ((p = malloc(t->bt_psize)) == NULL) {
- mpool_put(t->bt_mp, h, 0);
+ if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL)
bcopy(h, p, t->bt_psize);
bcopy(h, p, t->bt_psize);
- if (__bt_dleaf(t, h, t->bt_bcursor.index) == RET_ERROR)
+ if (status =
+ __bt_dleaf(t, h, t->bt_bcursor.index) == RET_ERROR)
goto ecrsr;
}
if ((status = mpool_sync(t->bt_mp)) == RET_SUCCESS)
goto ecrsr;
}
if ((status = mpool_sync(t->bt_mp)) == RET_SUCCESS)
- UNSET(t, BTF_MODIFIED);
+ CLR(t, BTF_MODIFIED);
+
ecrsr: if (ISSET(t, BTF_DELCRSR)) {
bcopy(p, h, t->bt_psize);
free(p);
ecrsr: if (ISSET(t, BTF_DELCRSR)) {
bcopy(p, h, t->bt_psize);
free(p);