svn commit: r295975 - head/lib/libc/db/recno
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Feb 24 17:14:13 UTC 2016
Author: pfg
Date: Wed Feb 24 17:14:11 2016
New Revision: 295975
URL: https://svnweb.freebsd.org/changeset/base/295975
Log:
db(3): Fix aliasing warnings from modern GCC.
While here also drop a malloc cast.
Obtained from: NetBSD (CVS Rev. 1.18 - 1.20)
Modified:
head/lib/libc/db/recno/rec_put.c
Modified: head/lib/libc/db/recno/rec_put.c
==============================================================================
--- head/lib/libc/db/recno/rec_put.c Wed Feb 24 17:10:32 2016 (r295974)
+++ head/lib/libc/db/recno/rec_put.c Wed Feb 24 17:14:11 2016 (r295975)
@@ -140,8 +140,7 @@ einval: errno = EINVAL;
return (RET_ERROR);
if (nrec > t->bt_nrecs + 1) {
if (F_ISSET(t, R_FIXLEN)) {
- if ((tdata.data =
- (void *)malloc(t->bt_reclen)) == NULL)
+ if ((tdata.data = malloc(t->bt_reclen)) == NULL)
return (RET_ERROR);
tdata.size = t->bt_reclen;
memset(tdata.data, t->bt_bval, tdata.size);
@@ -208,7 +207,7 @@ __rec_iput(BTREE *t, recno_t nrec, const
return (RET_ERROR);
tdata.data = db;
tdata.size = NOVFLSIZE;
- *(pgno_t *)db = pg;
+ memcpy(db, &pg, sizeof(pg));
*(u_int32_t *)(db + sizeof(pgno_t)) = data->size;
dflags = P_BIGDATA;
data = &tdata;
More information about the svn-src-head
mailing list