svn commit: r295973 - head/lib/libc/db/btree
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Feb 24 16:52:04 UTC 2016
Author: pfg
Date: Wed Feb 24 16:52:03 2016
New Revision: 295973
URL: https://svnweb.freebsd.org/changeset/base/295973
Log:
db(3): Fix aliasing warnings from modern GCC.
Obtained from: NetBSD (CVS Rev. 1.20)
Modified:
head/lib/libc/db/btree/bt_split.c
Modified: head/lib/libc/db/btree/bt_split.c
==============================================================================
--- head/lib/libc/db/btree/bt_split.c Wed Feb 24 16:50:34 2016 (r295972)
+++ head/lib/libc/db/btree/bt_split.c Wed Feb 24 16:52:03 2016 (r295973)
@@ -236,9 +236,12 @@ __bt_split(BTREE *t, PAGE *sp, const DBT
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, PAG
* 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);
More information about the svn-src-all
mailing list