svn commit: r353986 - stable/12/stand/libsa/zfs

Kyle Evans kevans at FreeBSD.org
Thu Oct 24 03:08:12 UTC 2019


Author: kevans
Date: Thu Oct 24 03:08:11 2019
New Revision: 353986
URL: https://svnweb.freebsd.org/changeset/base/353986

Log:
  MFC r348381: Unexpand be32dec().

Modified:
  stable/12/stand/libsa/zfs/zfsimpl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfsimpl.c
==============================================================================
--- stable/12/stand/libsa/zfs/zfsimpl.c	Thu Oct 24 03:06:37 2019	(r353985)
+++ stable/12/stand/libsa/zfs/zfsimpl.c	Thu Oct 24 03:08:11 2019	(r353986)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
  *	Stand-alone ZFS file reader.
  */
 
+#include <sys/endian.h>
 #include <sys/stat.h>
 #include <sys/stdint.h>
 #include <sys/list.h>
@@ -195,10 +196,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);
 }
@@ -206,10 +204,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