Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2019 02:23:57 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348381 - head/stand/libsa/zfs
Message-ID:  <201905300223.x4U2NvIl019064@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905300223.x4U2NvIl019064>