git: 381dd12cea17 - main - vfs: stop evaluating the argument multpile times in stat macros

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Sat, 12 Mar 2022 12:14:31 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=381dd12cea1715940b1f8f95f28614d664b020ad

commit 381dd12cea1715940b1f8f95f28614d664b020ad
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-03-12 11:47:07 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-03-12 11:47:07 +0000

    vfs: stop evaluating the argument multpile times in stat macros
---
 sys/sys/vnode.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 6e8373379587..f595029bdd14 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -966,18 +966,20 @@ void	vop_mkdir_debugpost(void *a, int rc);
 void	vop_rename_fail(struct vop_rename_args *ap);
 
 #define	vop_stat_helper_pre(ap)	({						\
+	struct vop_stat_args *_ap = (ap);					\
 	int _error;								\
 	AUDIT_ARG_VNODE1(ap->a_vp);						\
-	_error = mac_vnode_check_stat(ap->a_active_cred, ap->a_file_cred, ap->a_vp);\
+	_error = mac_vnode_check_stat(_ap->a_active_cred, _ap->a_file_cred, _ap->a_vp);\
 	if (__predict_true(_error == 0))					\
-		bzero(ap->a_sb, sizeof(*ap->a_sb));				\
+		bzero(_ap->a_sb, sizeof(*_ap->a_sb));				\
 	_error;									\
 })
 
 #define	vop_stat_helper_post(ap, error)	({					\
+	struct vop_stat_args *_ap = (ap);					\
 	int _error = (error);							\
-	if (priv_check_cred_vfs_generation(ap->a_active_cred))			\
-		ap->a_sb->st_gen = 0;						\
+	if (priv_check_cred_vfs_generation(_ap->a_active_cred))			\
+		_ap->a_sb->st_gen = 0;						\
 	_error;									\
 })