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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to