diff options
author | pfg <pfg@FreeBSD.org> | 2016-02-24 16:52:03 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-02-24 16:52:03 +0000 |
commit | b41bc87bfc60d65d12dd07c2f6a2ee4dfe06c6e7 (patch) | |
tree | 3f9a69f60cf655beb626572986098ffde582f4ea /lib/libc/db | |
parent | c6609a6326308be1bdee2b1a06712eded82398a5 (diff) | |
download | FreeBSD-src-b41bc87bfc60d65d12dd07c2f6a2ee4dfe06c6e7.zip FreeBSD-src-b41bc87bfc60d65d12dd07c2f6a2ee4dfe06c6e7.tar.gz |
db(3): Fix aliasing warnings from modern GCC.
Obtained from: NetBSD (CVS Rev. 1.20)
Diffstat (limited to 'lib/libc/db')
-rw-r--r-- | lib/libc/db/btree/bt_split.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c index f0db406..d42105d 100644 --- a/lib/libc/db/btree/bt_split.c +++ b/lib/libc/db/btree/bt_split.c @@ -236,9 +236,12 @@ __bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags, WR_BINTERNAL(dest, nksize ? nksize : bl->ksize, rchild->pgno, bl->flags & P_BIGKEY); memmove(dest, bl->bytes, nksize ? nksize : bl->ksize); - if (bl->flags & P_BIGKEY && - bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR) - goto err1; + if (bl->flags & P_BIGKEY) { + pgno_t pgno; + memcpy(&pgno, bl->bytes, sizeof(pgno)); + if (bt_preserve(t, pgno) == RET_ERROR) + goto err1; + } break; case P_RINTERNAL: /* @@ -544,9 +547,12 @@ bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r) * If the key is on an overflow page, mark the overflow chain * so it isn't deleted when the leaf copy of the key is deleted. */ - if (bl->flags & P_BIGKEY && - bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR) - return (RET_ERROR); + if (bl->flags & P_BIGKEY) { + pgno_t pgno; + memcpy(&pgno, bl->bytes, sizeof(pgno)); + if (bt_preserve(t, pgno) == RET_ERROR) + return (RET_ERROR); + } break; case P_BINTERNAL: bi = GETBINTERNAL(r, 0); |