diff options
author | pfg <pfg@FreeBSD.org> | 2016-02-24 17:14:11 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-02-24 17:14:11 +0000 |
commit | 78f743cc52efa55a9320befa717483937ebd1104 (patch) | |
tree | 146037371c25b6dc6c656a285f650cf34febb7eb /lib/libc/db | |
parent | 0151167359a8bc3b31532df14e6ab1281ebda3e9 (diff) | |
download | FreeBSD-src-78f743cc52efa55a9320befa717483937ebd1104.zip FreeBSD-src-78f743cc52efa55a9320befa717483937ebd1104.tar.gz |
db(3): Fix aliasing warnings from modern GCC.
While here also drop a malloc cast.
Obtained from: NetBSD (CVS Rev. 1.18 - 1.20)
Diffstat (limited to 'lib/libc/db')
-rw-r--r-- | lib/libc/db/recno/rec_put.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c index 441cced..68e6e85 100644 --- a/lib/libc/db/recno/rec_put.c +++ b/lib/libc/db/recno/rec_put.c @@ -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 DBT *data, u_int flags) 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; |