svn commit: r348381 - head/stand/libsa/zfs
Xin LI
delphij at FreeBSD.org
Thu May 30 02:23:58 UTC 2019
Author: delphij
Date: Thu May 30 02:23:57 2019
New Revision: 348381
URL: https://svnweb.freebsd.org/changeset/base/348381
Log:
Unexpand be32dec().
MFC after: 2 weeks
Modified:
head/stand/libsa/zfs/zfsimpl.c
Modified: head/stand/libsa/zfs/zfsimpl.c
==============================================================================
--- head/stand/libsa/zfs/zfsimpl.c Thu May 30 01:39:07 2019 (r348380)
+++ head/stand/libsa/zfs/zfsimpl.c Thu May 30 02:23:57 2019 (r348381)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
* Stand-alone ZFS file reader.
*/
+#include <sys/endian.h>
#include <sys/stat.h>
#include <sys/stdint.h>
@@ -128,10 +129,7 @@ zfs_free(void *ptr, size_t size)
static int
xdr_int(const unsigned char **xdr, int *ip)
{
- *ip = ((*xdr)[0] << 24)
- | ((*xdr)[1] << 16)
- | ((*xdr)[2] << 8)
- | ((*xdr)[3] << 0);
+ *ip = be32dec(*xdr);
(*xdr) += 4;
return (0);
}
@@ -139,10 +137,7 @@ xdr_int(const unsigned char **xdr, int *ip)
static int
xdr_u_int(const unsigned char **xdr, u_int *ip)
{
- *ip = ((*xdr)[0] << 24)
- | ((*xdr)[1] << 16)
- | ((*xdr)[2] << 8)
- | ((*xdr)[3] << 0);
+ *ip = be32dec(*xdr);
(*xdr) += 4;
return (0);
}
More information about the svn-src-all
mailing list